且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

推送通知状态检查Android

更新时间:2023-02-26 21:56:58

请看这里: http://developer.android .com / google / gcm / adv.html#unreg

有一种解释方式。

另一种方法可能是:如果您已经实现了GCM服务器,那么您的应用程序会向服务器发送一条消息,表明它不再需要任何更新。

此后,服务器从其设备数据库中删除该REGID。

从现在起,您的设备不应该收到任何推送消息。



您也可以尝试做出客户端决定并过滤消息用户不需要任何推送消息(这样他们仍然会在服务器端发送)。所以我会实现一个服务器端解决方案。似乎是最干净的方式。


User can disable push notifications in later versions of android for an application, is there any way application can know that push notifications are disabled by user in settings ?

Look here: http://developer.android.com/google/gcm/adv.html#unreg
There one way is explained.

Another way could be:
If you have implemented a GCM server then your app sends a message to the server that it does not want any updates anymore.
After that the server deletes the regId from its devices database.
From now on your device should not get any Push Messages.

You could also try to make a client side decision and filter the messages if the user does not want any push messages (that way they would still be sent on the server side)

So I would implement a server side solution. Seems to be the cleanest way for me.