Advertisement
Guest User

BootReceiver.java

a guest
Nov 8th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. package com.your.example;
  2.  
  3. import android.content.BroadcastReceiver;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.util.Log;
  7.  
  8. public class BootReceiver extends BroadcastReceiver {
  9. @Override
  10. public void onReceive(Context context, Intent intent) {
  11. if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
  12. Log.d("BootReceiver", "Boot completed, starting LocationPlugin service");
  13. Intent serviceIntent = new Intent(context, LocationPlugin.class);
  14. context.startForegroundService(serviceIntent); // Start service in the foreground
  15. }
  16. }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement