/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
*/
package thidinet.cordova.networkturn;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

import java.util.Locale;

public class NetworkTurn extends CordovaPlugin {

    // Flag indicates if the plugin is enabled or disabled
    private int isDisabled = 0;
	
	private CallbackContext connectionCallbackContext;

    /**
     * Executes the request.
     *
     * @param action The action to execute.
     * @param args The exec() arguments.
     * @param callback The callback context used when calling back into
     * JavaScript.
     * @return Returning false results in a "MethodNotFound" error.
     *
     * @throws JSONException
     */
    @Override
    public boolean execute(String action, JSONArray args,
            CallbackContext callback) throws JSONException {

         if (action.equals("wifi-enabled")) {           
            String connectionType = "hello";           
            PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType);
            pluginResult.setKeepCallback(true);
            callback.sendPluginResult(pluginResult);
            return true;
        }
        return false;
    }
	
	/**
     * Enable the Wifi mode.
     */
    private void setWifiStatus(int active) {
        isDisabled = 1;        
    }
	
	/**
     * Enable the Mobile data mode.
     */
    private void setMobileDataStatus(int active) {
        isDisabled = 1;        
    }	
}

/*
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
*/
package thidinet.cordova.networkturn;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

import java.util.Locale;

public class NetworkTurn extends CordovaPlugin {

    // Flag indicates if the plugin is enabled or disabled
    private int isDisabled = 0;
	
	private CallbackContext connectionCallbackContext;

    /**
     * Executes the request.
     *
     * @param action The action to execute.
     * @param args The exec() arguments.
     * @param callback The callback context used when calling back into
     * JavaScript.
     * @return Returning false results in a "MethodNotFound" error.
     *
     * @throws JSONException
     */
    @Override
    public boolean execute(String action, JSONArray args,
            CallbackContext callback) throws JSONException {

         if (action.equals("wifi-enabled")) {           
            String connectionType = "hello";          
            PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, isDisabled);
            pluginResult.setKeepCallback(true);
            callback.sendPluginResult(pluginResult);
            return true;
        }
        return false;
    }
	
	/**
     * Enable the Wifi mode.
     */
    private void setWifiStatus(int active) {
		WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
		boolean wifiEnabled = wifiManager.isWifiEnabled();
		if(wifiEnabled == true)
	        isDisabled = 1;        
    }
	
	/**
     * Enable the Mobile data mode.
     */
    private void setMobileDataStatus(int active) {
        isDisabled = 1;        
    }	
}

Update NetworkTurn.java