Is android.permission.RECEIVE_BOOT_COMPLETED not required?
NickName:capitalf Ask DateTime:2011-01-09T02:13:12

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 thought it was required but a few tutorials I used also didn't have it. A few did. I use my phone running CyanogenMod for testing but I doubt that matters. LogCat shows my "Notified of boot" log upon each boot. See below for code used.

AndroidManifest.xml

  <receiver android:name="AlarmReceiver">
   <intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
    <category android:name="android.intent.category.HOME" />
   </intent-filter>
  </receiver>

AlarmReceiver class

  public class AlarmReceiver extends BroadcastReceiver {
  private static final String TAG = "MyProgram";

  @Override
  public void onReceive(Context context, Intent intent) {
   try {
          if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
     Log.d(TAG, "Notified of boot");
           }
          Intent newIntent = new Intent(context, MyService.class);
          context.startService(newIntent);
    } catch (Exception e) {
     Log.d(TAG, "An alarm was received but there was an error");
     e.printStackTrace();
     }
    }
  }

I revisited this on the emulator and successfully reproduced the "problem" on Android 2.1, 2.2 and 2.3. I get an ANR (as expected) since the emulator doesn't have the database my app queries. When I remove all declared uses-permissions from the manifest, I get the expected permission denial errors when trying to use my app. However, I still receive the ACTION_BOOT_COMPLETED intent broadcasted upon boot. Any suggestions?

Copyright Notice:Content Author:「capitalf」,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/4635353/is-android-permission-receive-boot-completed-not-required

More about “Is android.permission.RECEIVE_BOOT_COMPLETED not required?” related questions

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

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

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

Do call to android.os.Looper.loop() require android.permission.RECEIVE_BOOT_COMPLETED to be specified in AndroidManifest.xml

At work, we run our apps through a security scan tool that does static analysis for vulnerabilities. Sometimes it flags things that aren't security related but could cause problems in some other w...

Show Detail

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

Implementing a service in android.permission.RECEIVE_BOOT_COMPLETED

I take below sample in net searching. I implemented the sample with some modification, but it shows error after rebooting the phone. I also pasting source code i used in the sample, please help m...

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

Is rooted device required to start app on boot?

I have developed application to start app on boot, but it is working on rooted devices only some of code as below. permission and receiver in AndroidManifest.xml file is given below. &lt;uses-

Show Detail

Warning of Google Play Developer policy violation: Action Required

Hello Google Play Developer, Our records show that your app, XXXX, with package name com.XXXX.XXXXXXXXXX, currently violates our User Data policy regarding Personal and Sensitive Information.

Show Detail

:required or [required] CSS selector

Browsing the MDN docs to see the status of a proposed pseudo-class, I came across :required (and by extension, :optional). Both of these have been around for a long time but I've only just learnt a...

Show Detail