Android.intent.action.BOOT_COMPLETED Intent not received on reboot or reboot.

Android android.intent.action.BOOT_COMPLETED Intent is not received if I use "Reboot" or "Reboot" , but it works if I disconnect on the device as well. Is there any way to make this work?

+7
android android-intent android-broadcast
source share
3 answers

Add

 <action android:name="android.intent.action.QUICKBOOT_POWERON" /> 

and

+20
source share

Add <action android:name="android.intent.action.QUICKBOOT_POWERON" /> this permission to the manifest file.

+3
source share

Remember to add the following permission:

 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> 

and add a receiver class entry in manifest.zml:

 <receiver android:name="com.example.receivers.BootReceiver" > 

Now the receiver class:

 import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class BootReceiver extends BroadcastReceiver { private static final String TAG = "Boot Receiver:::"; /* * (non-Javadoc) * * @see android.content.BroadcastReceiver#onReceive(android.content.Context, * android.content.Intent) */ @Override public void onReceive(Context context, Intent intent) { if (intent != null) { if (intent.getAction().equalsIgnoreCase( Intent.ACTION_BOOT_COMPLETED)) { //Boot Receiver Called } } } } 

Now clean and run the application. Hope This class will be called up after turning the power on / off or restarting the device. Let me know your feedback.

+1
source share

All Articles