I tried using the sample code in this link but it seems outdated and it did not work. So what changes do I have to make and to what files to have my app start automatically
Another approach is to use android.intent.action.USER_PRESENT
instead of android.intent.action.BOOT_COMPLETED
to avoid slow downs during the boot process. But this is only true
if the user has enabled the lock Screen - otherwise this intent is never broadcasted.
Reference blog - The Problem With Android’s ACTION_USER_PRESENT Intent