Start App on Boot – Android Studio Tutorial
In this video we will learn how to automatically start an activity when we boot up the device, by registering a BOOT_COMPLETED broadcast receiver and starting a new intent in it’s onReceive method.
On this intent we have to set the FLAG_ACTIVITY_NEW_TASK because we want to call startActivity from outside of an activity context.
To receive the boot broadcasts we have to add the RECEIVE_BOOT_COMPLETED permission into the manifest file.
On some devices, BOOT_COMPLETED will not be triggered when the device gets restarted, so we will also add the QUICKBOOT_POWERON intent filter.
Example code:
https://gist.github.com/codinginflow/7878602cfc5afde16d90f2d8d611c8a0
____________________
💻 Find the BEST programming tutorials on TutHub:
https://tuthub.io
⭐ Get my MVVM Caching Course now:
https://codinginflow.com/caching
❗ Subscribe to the channel:
https://www.youtube.com/c/codinginflo…
📨 Subscribe to the Coding in Flow newsletter:
https://codinginflow.com/newsletter
❓ Join our free developer community:
https://discord.gg/TSnMvmc
📣 Follow Coding in Flow on other sites:
Facebook: https://www.facebook.com/codinginflow
Instagram: https://www.instagram.com/codinginflow
TikTok: https://www.tiktok.com/@codinginflow
Twitter: https://twitter.com/codinginflow
Github: https://github.com/codinginflow
💰 Business requests, sponsoring, etc.: info@codinginflow.com
Views :79797
android studio