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
}
}
}