[英]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.