1

I have a BroadcastReceiver that i'm trying to detect when the system boot is completed but the Receiver doesn't get fired, or nothing in LogCat, any idea?

AndroidManifest

<!--  SIM Card Receiver -->

<receiver android:name=".SIMChangeNotifierActivity" android:enabled="true" android:exported="false"> 
    <intent-filter android:priority="1001"> 
        <action android:name="android.intent.action.BOOT_COMPLETED"/> 
    </intent-filter> 
</receiver>

BroadcastReceiver

public class SIMChangeNotifierActivity extends BroadcastReceiver {    

    public void onReceive(Context context, Intent intent)
    {
      if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction()))
      {
         Log.e("TAG", "Boot completed"); 
          }
}
tshepang
  • 12,111
  • 21
  • 91
  • 136
dythe
  • 840
  • 5
  • 21
  • 45

1 Answers1

11

Just declare in your manifest

 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Smit Patel
  • 1,174
  • 3
  • 26
  • 40