Search code examples
androidkotlinbroadcastreceiverandroid-broadcast

how to run Boot Broadcast Receiver on android 11


i am actually working on alarm app that set alarm ans store alarm data into room database,i want to Re Schedule my alarms after the phone reboot. all work fine but its not working on android 11.In android 11 the boot reciver not trigger and in other devices boot receiver trigger and set all the alarm stored in database

thanks

i am using this code

 override fun onReceive(context: Context?, intent: Intent?) {
    if (Intent.ACTION_BOOT_COMPLETED == intent?.action)
    {
        

    }
}

Solution

  • In Android 11 you need to open your app after restarting to receive Boot_Complete_receiver