In Android :
************
import android.content.Context;
import android.telephony.TelephonyManager;
String IMEI;
int Phno;
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
IMEI = telephonyManager.getDeviceId();
Phno = telephonyManager.getPhoneType();
super.loadUrl("file:///android_asset/www/index.html?IMEI="+IMEI+"&Phno="+Phno);
In Phonegap :
**************
var query = location.href.substring((location.href.indexOf('?')+1), location.href.length);
if(location.href.indexOf('?') < 0) query = '';
querysplit = query.split('&');
query = new Array();
for(var i = 0; i < querysplit.length; i++)
{
var namevalue = querysplit[i].split('=');
namevalue[1] = namevalue[1].replace(/\+/g, ' ');
query[namevalue[0]] = unescape(namevalue[1]);
}
var DeviceIMEI = query['IMEI'];
alert("DeviceIMEI : " + DeviceIMEI);
************
import android.content.Context;
import android.telephony.TelephonyManager;
String IMEI;
int Phno;
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
IMEI = telephonyManager.getDeviceId();
Phno = telephonyManager.getPhoneType();
super.loadUrl("file:///android_asset/www/index.html?IMEI="+IMEI+"&Phno="+Phno);
In Phonegap :
**************
var query = location.href.substring((location.href.indexOf('?')+1), location.href.length);
if(location.href.indexOf('?') < 0) query = '';
querysplit = query.split('&');
query = new Array();
for(var i = 0; i < querysplit.length; i++)
{
var namevalue = querysplit[i].split('=');
namevalue[1] = namevalue[1].replace(/\+/g, ' ');
query[namevalue[0]] = unescape(namevalue[1]);
}
var DeviceIMEI = query['IMEI'];
alert("DeviceIMEI : " + DeviceIMEI);
it didn't worked for me until I added the following lines before the definition of the class that extends DroidGap:
ReplyDeleteimport android.content.Context;
import android.telephony.TelephonyManager;
thanks (y)
ReplyDeletethanks very helpful :)
ReplyDeleteVery Thanks ;)
ReplyDelete