android.permission.RECEIVE_BOOT_COMPLETED does not launch activity at boot
NickName:Droidzilla Ask DateTime:2013-12-24T23:43:06

android.permission.RECEIVE_BOOT_COMPLETED does not launch activity at boot

I have a BootUpReceiver class which I'm attempting to use with RECEIVE_BOOT_COMPLETED to launch an Activity when the device boots. The problem is - it does not seem to do so when I launch the app then restart the device.

I have verified there is no issue running Activity1.java - the issue lies either in the Manifest or the BootUpReceiver class but I'm not sure exactly why it will not launch after rebooting.

BootUpReceiver.java:

public class BootUpReceiver extends BroadcastReceiver{


 @Override
 public void onReceive(Context context, Intent intent) {

     Intent i = new Intent(context, Activity1.class); 
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i); 

 }
}



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.com.idg.voiscphone"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.idg.voiscphone.Activity1"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

           <activity
            android:name="com.idg.voiscphone.Activity2"
            android:label="@string/app_name" >
        </activity>
          <activity
            android:name="com.idg.voiscphone.Activity3"
            android:label="@string/app_name" >
        </activity>
              <activity
            android:name="com.idg.voiscphone.Activity3a"
            android:label="@string/app_name" >
        </activity>
              <activity
            android:name="com.idg.voiscphone.Activity3b"
            android:label="@string/app_name" >
        </activity>
       <receiver android:enabled="true" android:name=".BootUpReceiver"
        android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
    </application>

</manifest>

Example Source:

http://androidrocksonmobility.blogspot.com/2012/01/how-to-create-auto-start-android.html

Copyright Notice:Content Author:「Droidzilla」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/20763380/android-permission-receive-boot-completed-does-not-launch-activity-at-boot

More about “android.permission.RECEIVE_BOOT_COMPLETED does not launch activity at boot” related questions

android.permission.RECEIVE_BOOT_COMPLETED does not launch activity at boot

I have a BootUpReceiver class which I'm attempting to use with RECEIVE_BOOT_COMPLETED to launch an Activity when the device boots. The problem is - it does not seem to do so when I launch the app t...

Show Detail

confusion in using android:permission for android.permission.RECEIVE_BOOT_COMPLETED

Please have a look at the following Maniferst.xml file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pack.s

Show Detail

BroadcastReceiver requires android.permission.RECEIVE_BOOT_COMPLETED

My Android app needs to be notified about the BOOT_COMPLETED event. AndroidManifest.xml contains &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt; and inside &lt;

Show Detail

android.permission.RECEIVE_BOOT_COMPLETED does not work

I want my application to start at bootup, but the following code does not work. I have seen few more similar threads, but unable to find a solution that works for me. &lt;?xml version="1.0" encod...

Show Detail

Launch activity on Boot completed and another activity on Mount completion

This my Androidmanifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.abc.testapp"

Show Detail

Android - Start Activity on Phone Boot Not Working

I'm trying to add a BroadcastReceiver to my program that will launch my MainActivity when the BOOT_COMPLETED action is detected. I've tried everything here and here and it refuses to work. I am r...

Show Detail

Start an Activity on Phone Boot in Android

I want to start my application automatically when the phone boots. I declared a BroadcastReceiver in the manifest file. &lt;receiver android:name=".Autostart"&gt; &lt;intent-filter&gt; &lt;

Show Detail

launch an activity every time the device is unlocked on android oreo

I am currently working on an app to launch an activity every time the device is unlocked, the following code works well for smaller devices with the Android api oreo. Manifest: &lt;receiver

Show Detail

How to launch service on boot complete android?

I've read some tutorial on launch service on boot. What I've done is: In manifest: &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" &gt; &lt;/uses-permission&gt;

Show Detail

Is android.permission.RECEIVE_BOOT_COMPLETED not required?

Does anyone know why my application still receives the ACTION_BOOT_COMPLETED broadcast even when my app doesn't have the permission android.permission.RECEIVE_BOOT_COMPLETED in the manifest file? I

Show Detail