package moe.minori.pgpclipper;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by Minori on 2015-09-26.
 */
public class BootListener extends BroadcastReceiver {

    public final static String ANDROID_ON = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent) {
        // BOOT_COMPLETED” start Service
        if (ANDROID_ON.equals(intent.getAction())) {

            // get preference
            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

            boolean isEnabled = preferences.getBoolean("enabledCheckBox", false);

            Intent serviceIntent = new Intent(context, PGPClipperService.class);

            //Service
            if ( isEnabled )
            {

                context.startService(serviceIntent);
            }
            else
            {
                context.stopService(serviceIntent);
            }
        }
    }
}

@@ -216,16 +216,41 @@
 Manager;
+%0Aimport android.util.Log;
 %0A%0A/**%0A *
@@ -501,16 +501,95 @@
 tent) %7B%0A
+        Log.d(%22PGPClipperBootListener%22, %22Received Boot Completed broadcast%22);%0A%0A
         
@@ -862,17 +862,27 @@
 oolean(%22
-e
+pgpClipperE
 nabledCh
@@ -884,17 +884,17 @@
 ledCheck
-B
+b
 ox%22, fal
@@ -1046,16 +1046,112 @@
       %7B%0A
+                Log.d(%22PGPClipperBootListener%22, %22Starting service since PGPClipper is enabled%22);
 %0A       
@@ -1233,32 +1233,130 @@
 e%0A            %7B%0A
+                Log.d(%22PGPClipperBootListener%22, %22Stopping service since PGPClipper is disabled%22);%0A
                 

Fix issue preventing startup when device is rebooted (silly me)