我使用GCM将通知消息从我的服务器推送到Android和iOS设备。如何使用InstanceID从服务器端发送通知? - 带有.NET服务器的GCM
目前我使用PushSharp库,它是这样使用:
string senderId = "my server id from google console";
string device_regId = "some device id";
//Create our push services broker
var push = new PushBroker();
//Registering the GCM Service and sending an Android Notification
push.RegisterGcmService(new GcmPushChannelSettings(senderId));
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(device_regId)
.WithJson("{\"message\":\"TestMessage!\",\"badge\":1}"));
我已经在谷歌阅读InsanceID Documentation,
的问题:
1 - 如何使用它在服务器端?
2-我目前的实施会发生什么变化?
3-有如何使用InsanceID代替RegisterationId这是以前使用的,并已弃用现在任何的例子吗?
是的,我已经检查了pushSharp代码,这是几乎相同的过程,这是在这里发布的java代码,所以我会尝试推送消息到IID令牌而不是注册ID,它应该工作,但!谢谢你的这个好回答 – MBH
使用InstanceId而不是RegistrationId工作完美! – MBH