![]() |
VOOZH | about |
In Android, applications can be configured to start automatically when the device finishes booting. This is useful for kiosk systems, IoT devices, robotics projects, and other dedicated applications. Android provides the BOOT_COMPLETED broadcast, which notifies apps when the system has completed startup, allowing them to launch an activity or start a service.
Note: Launching an app automatically on boot is officially depreciated by Android
Create a new Android project using Android Studio. You can choose either Java or Kotlin as the programming language.
Create a class named StartupOnBootUpReceiver that extends BroadcastReceiver. A BroadcastReceiver allows an application to respond to system-wide events such as:
Navigate to app > manifests > AndroidManifest.xml and add the piece of code given below to the file.
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Next, go to the activity_main.xml file, which represents the UI of the project.
Then restart your phone/emulator. It will automatically restart based on how much time your system takes to boot up.