package com.telepin.cellTower;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.CordovaInterface;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;

import android.content.Context;
import android.telephony.TelephonyManager;
import android.telephony.gsm.GsmCellLocation;
import android.util.Log;

import android.provider.Settings;

public class LocationInfo extends CordovaPlugin {

	/**
	 * Constructor.
	 */
	public LocationInfo() {
	}

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

		if (action.equals("getCID")) {
			
			this.getCID(callbackContext);
			return true;
		}
		return false;

	}

	public void getCID(CallbackContext callbackContext) throws IOException {
		TelephonyManager tm = (TelephonyManager) this.cordova.getActivity()
				.getApplicationContext()
				.getSystemService(Context.TELEPHONY_SERVICE);
		GsmCellLocation location = (GsmCellLocation) tm.getCellLocation();
		int cellID = location.getCid();
		if (cellID != null) {
			callbackContext.success(cellID + "");
		} else {
			callbackContext.error("Cell ID is null");
		}

	}

}

@@ -1166,33 +1166,8 @@
 ();%0A
-%09%09if (cellID != null) %7B%0A%09
 %09%09ca
@@ -1206,69 +1206,8 @@
 %22);%0A
-%09%09%7D else %7B%0A%09%09%09callbackContext.error(%22Cell ID is null%22);%0A%09%09%7D%0A%0A
 %09%7D%0A%0A

Update LocationInfo.java