Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I subscribe to the Tag Expression in Azure Notification Hub #11

Open
niren777 opened this issue Jun 26, 2019 · 5 comments
Open

Comments

@niren777
Copy link

I'm able to configure the Azure Notification Hub with Cordova app. The code, I used is given below

    pushNotification = PushNotification.init({
        notificationHubPath: '<notificationHubPath>',
        connectionString: '<connectionString>',
        android: {}
   });
  pushNotification.on('registration', function (data) {
        console.log('data.registrationId', data.registrationId);
        console.log(data.azureRegId);
   });
  pushNotification.on('error', function (data) {
        console.log(JSON.stringify(data));
  });
  pushNotification.on('notification', function (data) {
        console.log(JSON.stringify(data));
   });

with the above code, the mobile receives the notification when I send notification from Azure portal using Test Send. When I add Tag Expression in Test Send, the mobile is not receiving the notification.

I'm not sure how to subscribe to a particular tag

The function pushNotification.subscribe() gives error subscribe is not a function

Is there a way to subscribe to the tag?

@derek82511
Copy link
Owner

Hi niren777,
You can use your backend server to register a device to some tag by using the azure push notification hubs apis.
Here is the implementation of java: https://github.com/Azure/azure-notificationhubs-java-backend

@niren777
Copy link
Author

niren777 commented Jul 1, 2019

@derek82511 In the backend, we use python. We have integrated the backend with Azure Notification Hub using the tutorial https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-python-push-notification-tutorial. In the backend we use the tag to send a notification but the mobile is not receiving since the mobile is not registered to the particular tag.

The java based notification that you mentioned is different from the python backend. In our setup, the frontend is independent of backend. The backend only to serve the Restful APIs. So I'm not sure about registering the frontend device from the backend.

@derek82511
Copy link
Owner

@niren777 You can implement your python code to call the azure push notification hubs rest apis.

The link of register rest api: https://docs.microsoft.com/en-us/rest/api/notificationhubs/create-registration

The azure push notification hubs backend implementation of java almost use this rest api to register device or send message to azure.

@niren777
Copy link
Author

niren777 commented Aug 14, 2019

@derek82511 Should I still use this plugin(cordova-azure-notification-hubs) in my app If I register the device from the backend app?

@exhaler
Copy link

exhaler commented Feb 5, 2021

@derek82511 Should I still use this plugin(cordova-azure-notification-hubs) in my app If I register the device from the backend app?

@niren777 where you able to register the device in the backend?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants