The goal is to start the Alarm after reboot, but it does not start.
System Process issues this
10-24 13:16:04.460 477-487/system_process W/BroadcastQueue: Permission Denial: receiving Intent { act=android.intent.action.BOOT_COMPLETED flg=0x10 (has extras) } to com.xxxx.yyyy.project/.StartAtBoot requires android.permission.RECEIVE_BOOT_COMPLETED due to sender null (uid 1000) Manifest
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <receiver android:name=".StartAtBoot" android:enabled="true" android:exported="true" > <intent-filter > <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> StartAtBoot
@Override public void onReceive(Context context, Intent intent) { AlarmManager am= (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); if("android.intent.action.BOOT_COMPLETED".equalsIgnoreCase(intent.getAction())){ Intent i= new Intent(context, Receiver.class); PendingIntent pIntent2 = PendingIntent.getBroadcast(context, 0, i, 0); am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 10000, 10800000, pIntent2); System.out.println("BOOT_COMPLETED WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } } Receiver
public void onReceive(Context ctx, Intent intent) { System.out.println("BOOT_COMPLETED WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); }