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
Transfer Data from One Activity to Another Activity Using Intents
Single Click and Double Click of a Button in Android
Gradle 0.9.+/0.9.2 Error: Unable to Load Class 'Com.Android.Builder.Testing.Api.Deviceprovider'
Android.Os.Networkonmainthreadexception . Need to Use Async Task
Nested Fragments Disappear During Transition Animation
How to Stop an Animation (Cancel() Does Not Work)
How to Read Properties Defined in Local.Properties in Build.Gradle
Otp (Token) Should Be Automatically Read from the Message
Why There's a Separate Mutablelivedata Subclass of Livedata
Android:Understanding Drawable Folder
Limitation on Texture Size? Android Open Gl Es 2.0
Handling Keepsynced() While on Background on Android and with Fcm
How to Remove Extra Padding or Margin in Material Design Button
Get Response Status Code Using Retrofit 2.0 and Rxjava
Custom Global Application Class Breaks with "Android.App.Application Cannot Be Cast To"
Implicit "Submit" After Hitting Done on the Keyboard at the Last Edittext