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!
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.
Related
We have an app utilizing NFC and recently migrated from enableForegroundDispatch to enableReaderMode. Since then, we have been receiving bug reports where the user intermittently has trouble scanning tags.
I was troubleshooting remotely with a customer today who was unable to scan any tags (the app was working through yesterday). Sometimes they would receive an "NFC read error. Try again" message.
When we had them install the older version of our app which uses enableForegroundDispatch, NFC scans worked as intended. Scanning using the NFC Tools app was also working during this time, as was scanning with no app open. We tried rebooting the device and also toggling NFC on / off with no luck. It was just our app.
After much debugging, what appears to have resolved it was to fully delete our app from the device and then reinstall it. The device is a Google Pixel 2 running Android 11.
I have read countless threads about enableReaderMode and am also aware of this bug affecting kiosk apps in Android 11 (but our app isn't a kiosk). I also read about how there is a bug where Android might think our app is not in the foreground.
Is there any credence to the theory that deleting our app (vs. updating the same installed package with different builds) is what resolved this, and if so then what exactly is happening that is causing this?
Edit: I just found the threads about "NFC service dead" and am guessing this is what happened.
I have read the public code for NFC service, I cannot remember it having anything that would be affected differently by update vs uninstall/install other than possibly the Manifest(PackageManager?) permission to use NFC.
I have not looked in to details about how an app update updates the Manifest permissions, but guess an update might not update the permissions if it thinks they are not changed whereas remove/install would probably delete the whole entry and re-add it thus if there was corruption in the permission list a remove/install would likely fix it.
Also if the NFC Service is dead then other App's would not scan as well. I do seem to remember there is something in there to restart the NFC service if it had died.
My application contains a BOOT_COMPLETED receiver like described in other threads here. It works perfectly until I changed my app into a system application. Now the Receiver does not trigger the event anymore.
Any ideas for this issue? I'm using Android Kitkat 4.4.2 on a Radxa Rock Pro. Compiled my own image to register the app as system application.
we need more detail to help you, post the code and the manifest, also debug log, in other hand you must use Log.i(TAG, "onReceive."); to know if the problem is in onReceive() or when trying to run the service class.
Some friends and I have been working in an app that requires to have a service running listening for voice commands. We have successfully implemented the listener. However, after we started having problems because the operating system killed the service after a while (I suppose to reclaim some resources). We (apparently) fixed this problem by making the service a foreground process (calling startForeground).
We have been testing the app in a range of devices and we found out that the app was still being killed by the OS in some devices. Having a close look at this issue we found out that the devices where the app is being killed have Google Search version greater or equal to 2.3... (for instance 2.4.10.626027) If we uninstall the updates and downgrade to version 2.2.10.573038 then it works like a charm.
By the way, I have mentioned Google Search here because when we start the voice listener, a package named com.google.android.googlequicksearchbox is started.
Does anyone have an idea of why this might be? or what main differences exist between the versions 2.2.10.573038 (and older) and those after? Of course the solution would be to downgrade the version but we would like it to be compatible with the newer versions too...
I have written an SMS app to receive SMSes using the various samples available online. I tested it in a Android 2.3 device and it was working perfectly.
Now, I changed the API level to Android 4.0 and tried running it on an Android 4.0 device and nothing happens. I checked the logcat in Eclipse and nothing is displayed there too.
Any idea what needs to be done for it to work?
Check Once Again that you are actually creating and registering the
broadcast receiver in an Activity otherwise it will not get called
as after Android 3.1 it requires apps to be in started state to
receive broadcasts.
I implemented a BroadcastReceiver for the Android Market INSTALL_REFERRER Intent as
described here:
Get referrer after installing app from Android Market
It works fine for android devices earlier than 3.0 but it never seems to fire on Honeycomb devices. I've checked the logcat output during the install and after the app's first launch and I don't see any of my debug output which leads me to believe that the BroadcastReceiver isn't being run (I do see the output on pre-Honeycomb versions).
Can anyone out there confirm this problem?
Any idea how to make it work?
There's a new flag called FLAG_EXCLUDE_STOPPED_PACKAGES in 3.1:
If set, this intent will not match any components in packages that are currently stopped. If this is not set, then the default behavior is to include such applications in the result.
From the release notes for 3.1:
Note that the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents.
And also:
Applications are in a stopped state when they are first installed but are not yet launched and when they are manually stopped by the user (in Manage Applications).
Seems like this is breaking the behavior of INSTALL_REFERRER in 3.1+ devices as your app has not yet been launched and so can not receive the broadcast. Sadly I don't know of any way to make this work. Google could probably do something to fix this in their Market app (one way would be to just use FLAG_INCLUDE_STOPPED_PACKAGES though I'm not sure that would be a great idea, given the whole point of these new launch controls).
As i experienced the Broadcast Intent *INSTALL_REFERRER* is fired once before the Application is launched the first time If you don't catch it there, you'll never get it again