Search code examples
androidandroid-intentbroadcastreceiverbootcompleted

Broadcast Receiver not receiving on boot complete in android kitkat


It's not working after boot in kitkat 4.4.4 device.. please help .. even i ran the app after installation once without boot ,then booted, but same result. ANdroidManifes.xml

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

package="com.example.snaha.reminder1" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE"/>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <receiver android:process=":remote" android:name="AlarmReceiver"></receiver>
    <receiver
     android:name="com.example.snaha.reminder1.onBootComplete"
        android:enabled="true"
        android:exported="true"
        android:label="onBootComplete">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
    <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>
</application>

And here is my onBootComplete class

public class onBootComplete extends BroadcastReceiver {

    public void onReceive(Context content,Intent intent) {
        PendingIntent mAlarmSender=null;
        Toast.makeText(context, "Alarm Set"+"OnBoot",       Toast.LENGTH_SHORT).show();
        String dose=null;
        String category=null;

    }
}

Solution

  • Solved the problem, I installed app on SD card, which dsnt support on Boot Receiver!, I reinstalled it in phone memory and it worked! :)