TetheringEntitlementCheckTrigger TetheringEntitlementCheckTrigger TetheringEntitlementCheckTrigger TetheringEntitlementCheckTrigger TetheringEntitlementCheckTrigger Class

Definition

Represents a tethering event that triggers a background task to run.

public : sealed class TetheringEntitlementCheckTrigger : IBackgroundTrigger
struct winrt::Windows::ApplicationModel::Background::TetheringEntitlementCheckTrigger : IBackgroundTrigger
public sealed class TetheringEntitlementCheckTrigger : IBackgroundTrigger
Public NotInheritable Class TetheringEntitlementCheckTrigger Implements IBackgroundTrigger
var tetheringEntitlementCheckTrigger = new tetheringEntitlementCheckTrigger();
Attributes

Windows 10 requirements

Device family
Windows 10, version 1803 (introduced v10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)
Capabilities
networkConnectionManagerProvisioning

Examples

The following example shows how to create and register a tethering trigger:

using Windows.ApplicationModel.Background;

void RegisterTetheringTrigger()
{
  bool taskAlreadyRegistered = false;
  string exampleTaskName = "MyEntitlementTask";

  foreach (var task in BackgroundTaskRegistration.AllTasks)
  {
      if (task.Value.Name == exampleTaskName)
      {
          taskAlreadyRegistered = true;
          break;
      }
  }

  if (!taskAlreadyRegistered)
  {
      var builder = new BackgroundTaskBuilder();

      builder.Name = exampleTaskName;
      builder.TaskEntryPoint = "Sample.TheActualBackgroundTask";
      var trigger = new TetheringEntitlementCheckTrigger();
      builder.SetTrigger(trigger);
      builder.Register();
  }
}

Remarks

When this trigger is registered, and your cellular customer tries to turn on tethering through the Windows UI, the background task is triggered. As a mobile network operator, you can use the triggered background task to communicate to Windows whether your cellular customer is allowed to use the tethering feature based on their entitlement.

The background task will only be triggered if it is correctly registered in the Country and Operator Settings Asset (COSA) database for mobile operators. See Desktop COSA/APN database settings for details.

Warning

The tethering trigger may not behave as expected if it is reregistered multiple times

Constructors

TetheringEntitlementCheckTrigger() TetheringEntitlementCheckTrigger() TetheringEntitlementCheckTrigger() TetheringEntitlementCheckTrigger() TetheringEntitlementCheckTrigger()

Creates and initializes a new instance of a tethering event trigger.