With the DOS operating system (OS), you could start an application on system start-up by adding the application to the autoexec.bat file. With the Windows OS, you could add it to the run key in the Windows registry. How do you get an Android application to automatically run when the device boots up? It can be done by creating a broadcast receiver that listens to the BOOT_COMPLETED broadcast intent. The steps necessary to create such a broadcast receiver with Delphi XE5 include:
- create a new Delphi XE5 Android project
- set uses permissions to receive boot completed
- modify AndroidManifest.template.xml to let the Android system know you have a broadcast receiver
- write some Java code
- add it to the classes.dex
- use this new classes.dex in your project
- run the app on device
NOTE: Be sure to read the tips section as there are some important bits of information that are a must read to ensure your Android application will run when your Android device starts up.
Autorun A Delphi XE5 Firemonkey Android Application At Startup by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Tokyo Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.