Dynamic register of C2DM receiver using registerReceiver

不打扰是莪最后的温柔 提交于 2019-12-05 10:46:07

When a broadcast is sent by the system it will start applications to handle the intent if they have a matching intent filter declared in the manifest. Due to the nature of C2DM it is not useful to have a Broadcast Receiver installed dynamically because your application might not be running when a C2DM message is received. If its not running it won't be started for a dynamically installed receiver.

You can register the receiver C2DMReceiver in manifest file, and dispatch the intent to real BroadcastReceiver to handle it.

Fredrik Markstrom

It might make sense to receive the c2dm/gcm REGISTERED intent in a dynamically registered BroadcastReceiver in an Activity, but like the original author I've found that this isn't working (except for GCM on JB). Is there a reason for this ? I can't find this limitation in the docs anywhere.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!