TetheringEntitlementCheckTrigger Class

Definition

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

public ref class TetheringEntitlementCheckTrigger sealed : IBackgroundTrigger
/// [Windows.Foundation.Metadata.Activatable(393216, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 393216)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class TetheringEntitlementCheckTrigger final : IBackgroundTrigger
[Windows.Foundation.Metadata.Activatable(393216, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 393216)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class TetheringEntitlementCheckTrigger : IBackgroundTrigger
function TetheringEntitlementCheckTrigger()
Public NotInheritable Class TetheringEntitlementCheckTrigger
Implements IBackgroundTrigger
Inheritance
Object Platform::Object IInspectable TetheringEntitlementCheckTrigger
Attributes
Implements

Windows requirements

Device family
Windows 10, version 1803 (introduced in 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v6.0)
App 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()

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

Applies to