问题
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