Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.your.example;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.util.Log;
- public class BootReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
- Log.d("BootReceiver", "Boot completed, starting LocationPlugin service");
- Intent serviceIntent = new Intent(context, LocationPlugin.class);
- context.startForegroundService(serviceIntent); // Start service in the foreground
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement