0

I'm trying to get the IMEI with this command "adb shell dumpsys iphonesubinfo" but is not working. Also I try this: adb shell service call iphonesubinfo 1 but neither

I did this too but still is not working

How can I resolve it?

Community
  • 1
  • 1
  • 1
    Possible duplicate of [adb shell dumpsys iphonesubinfo not working since Android 5.0 Lollipop](http://stackoverflow.com/questions/27002663/adb-shell-dumpsys-iphonesubinfo-not-working-since-android-5-0-lollipop) – R. Zagórski Dec 01 '16 at 13:10
  • 1
    `adb shell service call iphonesubinfo 1` [Check this](http://stackoverflow.com/a/27003016/6809537) – GoneUp Dec 01 '16 at 13:15
  • I did that but it doesn't work because my smartphone is not rooted. Result: Parcel( 0x00000000: ffffffff 00000069 00650052 00750071 '....i...R.e.q.u.' 0x00000010: 00720069 00730065 00520020 00410045 'i.r.e.s. .R.E.A.' 0x00000020: 005f0044 00480050 004e004f 005f0045 'D._.P.H.O.N.E._.' 0x00000030: 00540053 00540041 003a0045 004e0020 'S.T.A.T.E.:. .N.' ... A kind of permission error – Ezequiel Salas Dec 01 '16 at 13:30

1 Answers1

0

Use below method to get IMEI simply..

public String getIMEI(Context context){
    String imei;
    TelephonyManager mngr = (TelephonyManager)context.getSystemService(context.TELEPHONY_SERVICE);
    imei = mngr.getDeviceId();
    if(imei!=null)
          return imei;
    else
          return "00";
}

Don't forget to get permission in manifest fine as line blew..

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