Android 4.0 c2dm issue

不想你离开。 提交于 2019-12-11 02:26:57

问题


When I'm using android c2dm to push notification to my devices, I have a strange problem.

If I'm closing application using "Manage apps->My application->force stop" and I try to send a push to my device, it doesn't work.

It works with all my other devices which have an Android version less than 4.0.

Any ideas?

Thanks

EDIT: Ok, I have investigated a little bit more, it seems that background code can not be run when an application is killed this way.

The system logs show me this:

05-09 11:43:15.450: W/GTalkService(25542): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE cat=[net.scimob.xxxxxx] (has extras) }

I don't know why it works on previous version of android and not 4.0 and more. Maybe google changed something in their code.

ps: When I use task killers, it doesn't use the same way to kill app and the c2dm push still works.

I hope this will help in the futur!


回答1:


If I'm closing application using "Manage apps->My application->force stop" and I try to send a push to my device, it doesn't work.

Correct. Don't do that.

It works with all my other devices which have an Android version less than 4.0.

This effect can be seen starting with Android 3.1. Apps when they are first installed, or are force-stopped, will not run again until the user manually launches some activity.



来源:https://stackoverflow.com/questions/10513530/android-4-0-c2dm-issue

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