简体   繁体   English

无法使用Azure Notification Hub在Android上发送通知

[英]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. 我正在尝试使用Azure Notification Hub将通知发送到android设备。

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: android模拟器可以如屏幕截图所示注册到集线器,但是当我尝试发送测试消息时,出现以下错误:

The Push Notification System handle for the registration is invalid

屏幕截图

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 Google已更新Firebase API,因此我已从示例中更新了代码

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. Firebase文档建议它应该是范围。

Can't figure out what is causing this to fail. 无法找出导致此失败的原因。 Any help will be much appreciated. 任何帮助都感激不尽。

Thanks 谢谢

您可以尝试使用INSTANCE_ID_SCOPE吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM