简体   繁体   English

如何将推送通知从Azure发送到Windows Mobile Cordova App

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

Hi i am using azure process to send the push notification to windows 10 above version hybrid app and i use the below code to send the notification 嗨,我正在使用azure进程将推送通知发送到Windows 10以上版本的混合应用程序,我使用下面的代码发送通知

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

i got this document there pushRegistration.on('registration', function (data) { this method is not firing is there any process to register before to send notification 我在那里得到了这个文档pushRegistration.on('registration',function(data){此方法未触发,在发送通知之前是否有任何要注册的过程

You have to implement a registerForPushNotifications method an call it every time user opens the App: 您必须实现一个registerForPushNotifications方法,并在用户每次打开该应用程序时对其进行调用:

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

If pushRegistration.on is not called, maybe registration is not complete or there is some error. 如果未调用pushRegistration.on,则可能是注册未完成或存在一些错误。 Create a breakpoint or print some message in: 在以下位置创建断点或打印一些消息:

pushRegistration.on('error', handleError);

And take a look if it's something wrong. 看看有什么问题。

Also, you can check if there is some missing configuration following the Notification Hubs Diagnosis guidelines: https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-fixer 另外,您可以按照通知中心诊断指南检查是否缺少某些配置: https : //docs.microsoft.com/zh-cn/azure/notification-hubs/notification-hubs-push-notification-fixer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何构建ASP.NET网站以将推送通知发送到Windows应用商店 - How do I build ASP.NET web site to send push notification to windows store app 如何通过Windows Azure通过GCM发送特定Android设备的通知? - How to send a notification for a particular android device by GCM through Windows azure? Cordova 上的 Windows Phone 8.1 移动应用程序中的分析 - Analytics in Windows Phone 8.1 mobile app on Cordova Windows应用程序和适用于移动应用程序的Azure应用程序服务 - Windows App with Azure App Services for Mobile Apps 通过Azure通知中心使用注册ID发送推送通知 - Send push notifications using Registration ID through Azure Notification Hubs 如何从云服务器向Windows桌面应用程序发送通知? - How to send notification to windows desktop application from cloud server? Windows Azure推送通知并捕获到特定网站页面的通知 - Windows azure push notication and catch the notification to a particular website page Windows App中的推送通知-如何更改Toast消息的内容? - Push Notification in Windows App - How can I change the content of the Toast Message? 如何在 Lua 中发送 Windows 通知? - How can I send a Windows Notification in Lua? 来自Azure网站的Android推送通知出现401错误 - 401 Error on Android Push Notification from Azure Website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM