package com.nyaruka.sigtrac;

import android.app.ActivityManager;
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) {
         checkService(context);
    }


    public static boolean checkService(Context context){
        if(!isServiceRunning(context)){
            startService(context);
            return false;
        } else {
            return true;
        }
    }


    private static void startService(Context context){
        context.startService(new Intent(context, PingService.class));
    }


    private static boolean isServiceRunning(Context context) {
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
            if (PingService.class.getName().equals(service.service.getClassName())) {
                return true;
            }
        }
        return false;
    }
}

@@ -645,29 +645,24 @@
     
-context.startService(
+Intent intent = 
 new 
@@ -695,16 +695,121 @@
 e.class)
+;%0A        intent.putExtra(HomeActivity.EXTRA_HOST, %22www.google.com%22);%0A        context.startService(intent
 );%0A    %7D

add host to ping to on the intent broadcasted at boot