When Android is booting ( Or you powered ON android first time or rebooted ), and when it has completed booting, Android sends a broadcast intent BOOT_COMPLETED to let all the applications, services know that now everything is setup and android booting has been completed, so we can start any other services , applications.
If our package name is com.android.TestService and Broadcast receiver intent is com.android.TestBroadcastReceiver
use below command to send boot completed intent manually from adb shell,
Refer code like below from AndroidManifest.xml to identify name of Broadcast receiver,
And the TestBroadcastReceiver class needs to defined as,
If you want to know, how this code can be used to receive an On Boot complete intent, you can refer to “Understanding Android Services with Example”