Chirdeep Tomar
Chirdeep Tomar

Reputation: 4461

Unable to send notification on android using Azure Notification Hub

I am trying to send a notification to an android device using Azure Notification Hub.

I have followed the tutorial here.

The android emulator can register to the hub as shown in the screenshot but when I am trying to send a test message I am getting the following error:

The Push Notification System handle for the registration is invalid

screenshot

Also the count it zero??? Is it registered or not?

Google has update the Firebase API so I have updated my code from in sample

String FCM_token = FirebaseInstanceId.getInstance().getToken();

to

String FCM_token = InstanceID.getInstance(this).getToken(NotificationSettings.SenderId, "RECEIVE");

I am not sure what the second argument should be. Firebase documentation suggests it should be scope.

Can't figure out what is causing this to fail. Any help will be much appreciated.

Thanks

Upvotes: 0

Views: 367

Answers (1)

Sateesh
Sateesh

Reputation: 376

Could you try with INSTANCE_ID_SCOPE?

InstanceID.getInstance(this).getToken(NotificationSettings.SenderId, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null)

Upvotes: 1

Related Questions