目前,当用户接受 VOIP 呼叫时,我们正在尝试使用
LaunchUriAsync
从 PushNotificationTrigger BackgroundTask 启动应用程序。 LaunchUriAsync
仅适用于附加的调试器,一旦分离调试器 LaunchUriAsync
就会停止启动应用程序。重新连接到进程后,它再次开始工作。
public sealed class PushNotificationReciever : IBackgroundTask
{
public async void Run(IBackgroundTaskInstance taskInstance)
{
BackgroundTaskDeferral _deferral = taskInstance.GetDeferral();
RawNotification notification = (RawNotification)taskInstance.TriggerDetails;
await Windows.System.Launcher.LaunchUriAsync(new Uri("custom:\\data"));
deferral.Complete();
}
}