0
votes

Hi I'm following this tutorial https://github.com/ggailey777/mobile-services-samples/tree/master/CordovaNotificationsArticle to add iOS push notification to my Cordova project but couldn't get it to work. The APNS certificate is configured and I've uploaded the p12 file to azure mobile notification.

When I run the app it shows "Registered with Azure!" and in azure notification hub I can see the registration.

enter image description here

However when I send test push notification using visual studio, the message result is empty. enter image description here

If I use azure portal, it shows "The test notification was sent" enter image description here

And my iphone never got any notifications either when it's open or closed.

Am I missing something? Any help is much appreciated.

Thanks!

1
Are you writing an Apache Cordova app or an iOS Objective-C app? You start by stating one and then go on to describe the other, leaving me a little confused as to what you are trying to do.Adrian Hall
Hi! This is an Apache Cordova app, but in order to send push notifications from azure to iOS apps, I have to modify the native code as in the tutorial. azure.microsoft.com/en-us/documentation/articles/…Vincent Liao
You can't just combine a Cordova app running on iOS and an iOS native app. The push plugin handles the iOS native notification coming from Azure Notification Hubs. Have you already done troubleshooting of your notification hub as described in this topic? Are you not getting notifications when the app is open or closed?Glenn Gailey - MSFT
@GlennGailey-MSFT, I've modified the question to provide you more detail and what is the url of the troubleshooting document? I cannot open the link that you provide in the comment. Thanks!Vincent Liao
Sorry for giving you a bad link. The correct troubleshooting link is here: azure.microsoft.com/en-us/documentation/articles/…Glenn Gailey - MSFT

1 Answers

0
votes

You are mixing and matching technologies. You cannot use iOS Native code in an Apache Cordova app. Based on your comments, use the cordova-push-notifications plugin. The README.md in the project describes how to add it for iOS. It's relatively simple.

You will still have to deal with how to get your device registered with Notification Hubs and getting a notification sent to your device. That is covered in detail in the Azure Notification Hubs documentation.