Broadcast Receiver Not Working in Ics If the App Is Not Started Atleast Once

Broadcast receiver not working in ICS if the app is not started atleast once

Is there any solution for this in ICS?

It is working correctly. As of Android 3.1, no BroadcastReceiver will work until the user has manually launched an activity. I blogged about this eight months ago.

Broadcast Receiver not getting the broadcast if app is not started

Apparently in Android 3.1+, apps are in a stopped state if they have never been run, or have been force stopped. The system excludes these apps from broadcast intents. They can be included by using the Intent.FLAG_INCLUDE_STOPPED_PACKAGES flag.

http://commonsware.com/blog/2011/07/13/boot-completed-regression-confirmed.html

http://developer.android.com/sdk/android-3.1.html#launchcontrols

Also, I think you need the Intent.FLAG_ACTIVITY_NEW_TASK flag.

Android broadcast receiver to get status of installation even app is closed

basically, BroadcastReceiver can receives broadcasts even if your app is not in foreground, or even if your application's process is not alive.
this can be done by declaring the receiver within your application's Manifest.xml file

when you declare a receiver in the Manifest file - then the system would wake up your application and invoke your receiver if it set with the appropriate intent filter that responding to the broadcast that been sent (in your case - ACTION_PACKAGE_INSTALL and PACKAGE_REMOVED actions..)

but unfortunately there are also bad news for you:

from Android ICS and above - you cannot receive any broadcasts until you application launched explicitly by the user at least once!

this is due to security reasons Google decided is necessary, to prevent from malicious apps doing staff entirely transparent without the user launched them at all even once..

so the answer basically is - no! you can't perform any code and receive any events from your app until it launched at least once.

by the way - you wouldn't received ACTION_PACKAGE_INSTALL and PACKAGE_REMOVED broadcasts for your own app that been installed or uninstalled anyway.

by reading your question again, honestly I'm not sure what is that you expects to happend:
it is no make any sense to "check your application installed status" if it unistalled or not. after all - if it uninstalled - then it can't run (and perform any code) anyway.

broadcastreceiver not working while phone is booting in Android

Check this out..
I also had the same problem Broadcast not invoking:

According to my knowledge the problem is with Android HoneyComb and ICS. I have tested same application on HoneyComb,ICS, Ginger Bread and Froyo. Worked perfectly for Froyo and Ginger bread but not for honeycomb or ics.

Broadcast receiver onReceive() never called

In ICS you won't receive broadcasts until your app is started manually at least once.in Android 3.1+, apps are in a stopped state if they have never been run, or have been force stopped. The system excludes these apps from broadcast intents. They can be included by using the Intent.FLAG_INCLUDE_STOPPED_PACKAGES flag like this..

i.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);

Android Boot-Up BroadCast Not invoking

Everything was fine..:S
The problem was with device..(i.e. Motorolla Zoom ICS 4.0.3)

Now tested on Galaxy Tab With 2.2 and Working fine..

Thanks all for your time



Related Topics



Leave a reply



Submit