简体   繁体   中英

How to get IMEI, LAC/CELLID in android

how to get IMEI, data of LAC/CELLID? Is it easy? in android/iphone? Could you please drop me few lines?

For IMEI does it

    TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    String IMEI = tm.getDeviceId();

with

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

Make use of TelephonyManager , like following lines:

 TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); GsmCellLocation location = (GsmCellLocation) tm.getCellLocation(); String IMEI = tm.getDeviceId(); int lac = location.getLac(); ... ...

Also, you should use the permissions:

 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM