Search code examples
androidbroadcastreceiverandroid-serviceandroid-alarmsandroid-broadcastreceiver

Broadcast receiver not working when app is cleared from RAM


I am new to android. I am making an alarm clock. Its working perfectly until the user clears the app from the RAM. On searching, I found that broadcast receivers don't work if the app is cleared from the RAM. So, what exactly should I do? Will sending the broadcast from a service help? Also if you have a link to a good tutorial to Services in android, pls do share. Also let me know if there is some other way to solve my problem.


Solution

  • In Xiaomi devices, you just have to add your app to Autostart list, to do so, follow these simple steps given below:

    • Open Security app on your phone.

    • Tap on Permissions, it'll show you two options: Autostart and Permissions

    • Tap on Autostart, it'll show you list of apps with on or off toggle buttons.

    • Turn on toggle of your app, you're done!