如何判断GCM令牌是否有效,而不发送通知? [英] How to tell if GCM token is valid, without sending a notification?

查看:186
本文介绍了如何判断GCM令牌是否有效,而不发送通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法告诉GCM令牌何时不再有效,而实际上并未尝试发送通知并收到错误?

谢谢。

解决方案

您可以使用google提供的干运行功能来完成此操作。



当从Web服务器向GCM服务器发送通知请求时,您可以添加 dry_run 键为 true

此参数允许开发人员在不实际发送消息的情况下测试请求。默认值为false,并且它必须是JSON布尔值。



如果通知密钥无效,它会给出请求的相应http响应


Is there a way to tell when a GCM token is no longer valid, without actually attempting to send a notification and receive an error?

Thanks.

解决方案

You can do this by using the dry run feature provided by the google.

When sending request for a notification from your web server to GCM servers you can add dry_run key to be true

This parameter allows developers to test a request without actually sending a message. The default value is false, and it must be a JSON boolean.

If the Notification key is invalid it would give the corresponding http response of the request

这篇关于如何判断GCM令牌是否有效,而不发送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆