
我有Android设备和iOS设备.每当我在应用程序中更改任何内容时,其他设备都应该获得推送通知. iOS设备正在运行.
在AndroID上订阅的C#代码:
[Service(Exported = false)]public class RegistrationIntentService : IntentService{ static object locker = new object(); public RegistrationIntentService() : base("RegistrationIntentService") { } protected overrIDe voID OnHandleIntent(Intent intent) { try { Log.Info("RegistrationIntentService","Calling InstanceID.GetToken"); lock (locker) { var instanceID = InstanceID.GetInstance(this); var token = instanceID.GetToken( "shhh it's a secret.",GoogleCloudMessaging.InstanceIDScope,null); Log.Info("RegistrationIntentService","GCM Registration Token: " + token); SendRegistrationToAppServer(token); Subscribe(token); } } catch (Exception e) { Log.DeBUG("RegistrationIntentService","Failed to get a registration token"); return; } } voID SendRegistrationToAppServer(string token) { // Add custom implementation here as needed. //... handling my token on the back-end } voID Subscribe(string token) { var pubSub = GcmpubSub.GetInstance(this); pubSub.Subscribe(token,"/topics/global",null); }} 在那里删除一些断点我可以看到我的设备令牌与我尝试向其发送消息的AWS端点的令牌匹配.但出于某种原因,我不断从AWS收到错误消息.这就是AWS发送给我的内容:
{“DeliveryAttempts”:1,“EndpointArn”:“arn:aws:sns:…:endpoint / GCM / …”,“EventType”:“DeliveryFailure”,“FailureMessage”:“与端点关联的平台令牌无效“,”FailureType“:”InvalidplatformToken“,”MessageID“:”…“,”资源“:”arn:aws:sns:…:app / GCM / …“,”服务“ : “SNS”,“时代周刊”: “2016-03-28T18:22:59.360Z”}
如果我知道我从应用程序返回的令牌与我的AWS端点的令牌匹配,那么可能导致这种情况的原因是什么?
解决方法 传递给SNS的注册ID很可能是不正确的.我建议您打开交付状态并查看GCM的实际响应,有关信息,请参阅 https://mobile.awsblog.com/post/TxHTXGC8711JNF/Using-the-Delivery-Status-feature-of-Amazon-SNS 总结以上是内存溢出为你收集整理的AWS SNS Android GCM – InvalidPlatformToken全部内容,希望文章能够帮你解决AWS SNS Android GCM – InvalidPlatformToken所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)