I did a android application which launch just after boot finishes. It works in android 2.3.3 and Android 3.1 but when i force closed application which runs in android 3.1 and i reboot again the application doesn't come after boot ?
when i force closed application which runs in android 3.1 and i reboot again the application doesn't come after boot ?
Correct. On Android 3.1+, the following types of applications will not run automatically:
Those applications must first manually be started by the user (e.g., launching one of your activities) before they will receive any broadcast Intents
again.
i do it with this code and it works for me:
public class AutoStarter extends BroadcastReceiver {
public void onReceive(Context context, Intent intent)
{
if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction()))
{
Intent serviceLauncher = new Intent(context, your.class);
context.startService(serviceLauncher);
}
}
}
for testing you can use this in your cmd
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With