We want to get the IMSI
number for the mobile device in order to find out if the user is registered to use particular application or not.
I did search on the net. It say Worklight is using Cordova. It gives UUID and device name /description but not IMSI number.
I am trying this code here. but the cordova always goes to getfailure. and says Class Not Found. I am using IBM Worklight
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import android.provider.Settings;
import android.content.Context;
import android.telephony.TelephonyManager;
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("imeiNumber")) {
org.json.JSONObject r = new org.json.JSONObject();
TelephonyManager tManager = (TelephonyManager) cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE);
r.put("imei", "sampleimei");
r.put("imsi", "sampleimsi123");
r.put("tmanagerimsi", tManager.getSimSerialNumber());
r.put("deviceModal", this.getModel() );
callbackContext.success(r);
return true;
}
else {
return false;
}
}
javascript:
function getImei(){
alert("inside getImei");
cordova.exec(getSuccess, getFailure, "DeviceDetails", "imeiNumber", []);
}
function getSuccess(data){
alert(data.imei +" "+data.imsi+" "+data.tmanagerimsi);
}
function getFailure(data){
alert(data);
alert(data.imei +" "+data.imsi+" "+data.tmanagerimsi+" "+data.deviceModal);
}