If you want to print a notification when the device boots, you can create a receiver that is called when the system boots up, to do this, first create a receiver,
public class MyReciever extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Log.d("BOOT COMPLETE","SERVICE CALLED>>>>>>>>>>>>");
This receiver is called when the system boot is complete. You can also call the service from the onReceive method of the recipient to print a notification.
You should also identify the following patterns in your manifest file,
First, determine permission to get the intent BOOT_COMPLETION,
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
Then determine your receiver,
<receiver android:name=".MyReciever" android:enabled="true" android:exported="false"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver>
source share