Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Push notification 收到通知时是否可以播放声音?_Push Notification_Windows Phone 8.1 - Fatal编程技术网

Push notification 收到通知时是否可以播放声音?

Push notification 收到通知时是否可以播放声音?,push-notification,windows-phone-8.1,Push Notification,Windows Phone 8.1,我正在研究在我的解决方案中实现推送通知,我希望在收到通知时播放特定于应用程序的声音 我一直在使用以下示例作为指导: 我在应用程序清单中添加了pushNotification作为后台任务: <Extensions> <Extension Category="windows.backgroundTasks" EntryPoint="PushNotificationsHelper.MaintenanceTask"> <BackgroundTasks>

我正在研究在我的解决方案中实现推送通知,我希望在收到通知时播放特定于应用程序的声音

我一直在使用以下示例作为指导:

我在应用程序清单中添加了
pushNotification
作为后台任务:

<Extensions>
  <Extension Category="windows.backgroundTasks" EntryPoint="PushNotificationsHelper.MaintenanceTask">
    <BackgroundTasks>
      <Task Type="systemEvent" />
      <Task Type="pushNotification"/>
    </BackgroundTasks>
  </Extension>
</Extensions>
执行这个Run方法,然后让我播放一个声音,这将是非常理想的

但是,在使用Windows Phone emulator的通知工具进行测试时,无法启动run方法

我需要做什么才能让它运行?我是否有其他方式播放与我的应用程序相关的声音

namespace PushNotificationsHelper
{
    public sealed class MaintenanceTask : IBackgroundTask
    {
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            Notifier notifier = new Notifier();
            notifier.RenewAllAsync(false).AsTask().Wait();

            // here I can execute my code to locate the sound in my solution and play it
        }
    }
}