android - IBM Worklight - How to get IMSI number from mobile device? -


we want imsi number mobile device in order find out if user registered use particular application or not.

i did search on net. worklight using cordova. gives uuid , device name /description not imsi number.

i trying code here. cordova goes getfailure. , says class not found. 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); } 

is pasted above full java file? because not seem complete.

you missing class declaration. classes in java defined like:

public class dog{  //stuff } 

i not see anywhere in code.

also, when installing plugin need modify config.xml reflect this.

please review guide: http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/06_05_android_-_adding_native_functionality_to_hybrid_application_with_apache_cordova_plugin.pdf


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -