Search code examples
androidandroid-permissionsuser-permissionsbootcompleted

RECEIVE_BOOT_COMPLETED is not working in Lollipop device


I have trying to implement a receiver which will work on startup, in my application. for that I have created a MyReceiver class and then added that in my manifest. am also added the permission too. But its not working and also not showing in the app info.

here is my manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.inapp.sampleboot" >

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".MyReceiver"
            >
            <intent-filter>
                <action android:name="ANDROID.INTENT.ACTION.BOOT_COMPLETED"/>
                <action android:name="android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

My reciever class

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class MyReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {

    }
}

Solution

  • I thinks this will be a solution

    <uses-permission android:name="ANDROID.PERMISSION.READ_EXTERNAL_STORAGE" />
    

    Android is case-sensitive in most places. Please change this to:

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