PeterStaev / nativescript-azure-mobile-apps

:cloud: NativeScript plugin for working with Microsoft Azure Mobile Apps services
Apache License 2.0
30 stars 10 forks source link

Push notification #28

Closed wjlabcwjl closed 6 years ago

wjlabcwjl commented 6 years ago

Hello, I know how to use the plugin https://github.com/NativeScript/push-plugin to push notification to android device with Firebase, but what is the relationship between Azure mobile app and the push functionality in this plugin ? I need to configure something in Azure mobile app ?

PeterStaev commented 6 years ago

Hey @wjlabcwjl , the push plugin just registers your devices for push. But someone needs to send those pushes. This plugin utlizes the functionality that is given by the Azure mobile apps framework to register the device with Azure and then you use Azure to send the notifications. The benefit is that Azure can send notification to both platforms. So you have single code to send notifications for both iOS and Android.

wjlabcwjl commented 6 years ago

Hi, @PeterStaev , thanks for your response. I did some search and read some doc of Azure, to use the plugin and azure push notification, I should set up a Azure notification hub and connect it to my Azure mobile app, and connect the hub with my Firebase project, am I right?

Then I tried your plugin, like your demo code, but there are some errors due to the code below: let client = new MobileServiceClient("https://xxxx.azurewebsites.net"); when I try to launch my app on my physical android device, with command tns run android --bundle, I got the errors, please find the logs in the attached file. log.txt

PeterStaev commented 6 years ago

From your log seems more like that something is not built in correctly. Try clearing your platforms and rebuilding.

As for the notifications hub - MS discontinued using those directly. They are now coupled with the Azure Mobile Apps. So you need to create an Azure Mobile App then enable Push for it and associate a notification hub with it. The URL is the URL of the mobile app and not the notification hub.

PeterStaev commented 6 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.