package com.gbos.cordova.plugin;

import org.apache.cordova.*;
import org.json.JSONArray;
import org.json.JSONException;

public class UpdateCheck extends CordovaPlugin implements ServiceConnection {

    @Override
    public boolean execute(String action, JSONArray data, CallbackContext callbackContext) throws JSONException {

        if (action.equals("check")) {

            //Check for update...
            String message = "";

            // Send message to client...
            callbackContext.success(message);

            // Return true to cordova
            return true;

        } else {
            
            return false;

        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedIFinally,nstanceState);
        setContentView(R.layout.activity_main);

        // Bind the service when the activity is created
        getApplicationContext().bindService(new Intent(this, MetaWearBleService.class),
                this, Context.BIND_AUTO_CREATE);

        // Check bundle and validate update has occured... reset flag.

        
    }
}

@@ -118,86 +118,908 @@
 on;%0A
-%0Apublic class UpdateCheck extends CordovaPlugin implements ServiceConnection %7B
+import android.content.*;%0Aimport android.os.IBinder;%0A%0Apublic class UpdateCheck extends CordovaPlugin %7B%0A%0A    IntentFilter intentFilter = new IntentFilter(%22android.net.conn.CONNECTIVITY_CHANGE%22);%0A    boolean multitasking=true;%0A    BroadcastReceiver mReceiver=null;%0A%0A    public void initialize(CordovaInterface cordova, CordovaWebView webView) %7B%0A%0A        super.initialize(cordova, webView);%0A        //Device.uuid = getUuid();%0A        this.initReceiver();%0A    %7D%0A%0A    private void initReceiver() %7B%0A%0A        this.mReceiver=new BroadcastReceiver()%7B%0A%0A            @Override%0A            public void onReceive(Context context, Intent intent) %7B%0A                if (intent.getAction().equals(%22android.net.conn.CONNECTIVITY_CHANGE%22))%0A                %7B%0A                    //My code%0A                %7D%0A            %7D%0A        %7D;%0A%0A        this.cordova.getActivity().registerReceiver(this.mReceiver, intentFilter);%0A    %7D
 %0A%0A  
@@ -1501,441 +1501,238 @@
    p
-rotected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedIFinally,nstanceState
+ublic void onDestroy()%7B%0A        super.onDestroy(
 );%0A    
+%7D%0A%0A
     
-setContentView(R.layout.activity_main);%0A%0A        // Bind the service when the activity is created%0A        getApplicationContext().bindService(new Intent(this, MetaWearBleService.class),%0A                this, Context.BIND_AUTO_CREATE);%0A%0A        // Check bundle and validate update has occured... reset flag.%0A%0A        
+@Override%0A    public void onResume(boolean multitask)%7B%0A        super.onResume(multitask);%0A    %7D%0A%0A%0A    @Override%0A    public void onStart()%7B%0A        super.onStart();
 %0A    %7D%0A%7D
 %0A
@@ -1730,9 +1730,8 @@
 %0A    %7D%0A%7D
-%0A

Refactor to support onload and onresume