簡體   English   中英

如何將推送通知從Azure發送到Windows Mobile Cordova App

[英]How to send push notification from azure to windows mobile cordova app

嗨,我正在使用azure進程將推送通知發送到Windows 10以上版本的混合應用程序,我使用下面的代碼發送通知

https://docs.microsoft.com/zh-CN/azure/app-service-mobile/app-service- mobile-cordova-get-started-push

我在那里得到了這個文檔pushRegistration.on('registration',function(data){此方法未觸發,在發送通知之前是否有任何要注冊的過程

您必須實現一個registerForPushNotifications方法,並在用戶每次打開該應用程序時對其進行調用:

var pushRegistration = null;
 function registerForPushNotifications() {
   pushRegistration = PushNotification.init({
       android: { senderID: 'Your_Project_ID' },
       ios: { alert: 'true', badge: 'true', sound: 'true' },
       wns: {}
   });

如果未調用pushRegistration.on,則可能是注冊未完成或存在一些錯誤。 在以下位置創建斷點或打印一些消息:

pushRegistration.on('error', handleError);

看看有什么問題。

另外,您可以按照通知中心診斷指南檢查是否缺少某些配置: https : //docs.microsoft.com/zh-cn/azure/notification-hubs/notification-hubs-push-notification-fixer

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM