GCM Registration Id for Notifications with Azure

GCM Registration Id for Notifications with Azure

  

How can I subscribe to GCM and get the Registration Id so that I can send it to Microsoft Azure to manage the push notifications?



Hello Filipe,

Check if the steps on this documentation work. The 1st part is all about configuring GCM to allow sending push notifications to android.

Cheers,
R

Hello Rodrigo,

Thanks for reaching out.

We've checked that doc, but it doesn't solve our problem. We have everything configured with Firebase but is the after configuration that we need.

Basically, we need the equivalent to this https://developers.google.com/cloud-messaging/android/client 

Any pointers? 

Just to make sure I've understood correctly: You have everything configured on the FCM side, now you want to send messages to your devices. Is that it?

If this is the case, and you want to do it the hard way, I think you need to look at the HTTP or XMPP API. I haven't tried it before, so I don't know how easy or hard it is...

But if you want to send notifications, why not use the oneSignal plugin? Doesn't it do what you need?

Cheers,
R

We are using Microsoft Azure Notification Hub to manage our push notifications. We got the iOS notifications working properly and is already subscribing to the Azure Notification Hub.

However, with android and we need the Registration Id to be able to subscribe the device to the Azure, like so:

<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
    <content type="application/xml">
        <GcmRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
            <Tags>myTag, myOtherTag</Tags>
            <GcmRegistrationId>{GCM Registration Id}</GcmRegistrationId> 
        </GcmRegistrationDescription>
    </content>
</entry>

(source: https://msdn.microsoft.com/en-us/library/azure/dn223265.aspx )


For what I am concluding is that I will need to use Firebase javascript client: https://firebase.google.com/docs/cloud-messaging/js/client 

and get the Registration ID by like this: https://github.com/firebase/quickstart-js/blob/master/messaging/index.html#L133-L153

For Azure Notification Hub, what I found was this: Sending push notifications to Android with Azure Notification Hubs. (There's a link in the article if you're using FCM instead of GCM).

Does it help?

Cheers,
R

That is indeed what we are trying to build, except to instead of using Android, we are using Outsystems.
We have built an Azure plugin and uploaded to the Forge to wrap Cordova and make the subscriptions and everything with Azure.

However, now, we need to be able to find the Registration Id, we decided to use javascript to get it.


This seems sketchy but hope to work, I'll updated this thread afterwards.