LocationListener and LocatioManager play important role to find our exact longitude and latitude in android application. LocationListener will get signal from Locationmanager when location has changed .
Src:
Location myloc;
LocationManager locMan;
Set function parameter:
Context ctx ; // Get context from main activity.
locMan = (LocationManager) ctx .getSystemService(Context.LOCATION_SERVICE);
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 15000, 0, location listener obj);
myloc= locMan.getLastKnownLocation(LocationManager.GPS_PROVIDER);
onLocationChanged( Location loc) function get called when location has changed.
Thursday, 25 March 2010
Wednesday, 1 April 2009
Get Cell Info (Device ID,Subscriber ID)
Hi Android Developers,
For getting cell information and device information following data can help you.
String IMSI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
String IMEI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMEI);
******************* OR *************************
Can write the code in a Activity class to get info....
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();
Do not forget to set 'uses-permission android:name="android.permission.READ_PHONE_STATE"' in AndroidManifest.xml.
For getting cell information and device information following data can help you.
String IMSI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMSI);
String IMEI = android.os.SystemProperties.get(android.telephony.TelephonyProperties.PROPERTY_IMEI);
******************* OR *************************
Can write the code in a Activity class to get info....
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();
Do not forget to set 'uses-permission android:name="android.permission.READ_PHONE_STATE"' in AndroidManifest.xml.
Subscribe to:
Posts (Atom)
