简体   繁体   中英

How to get IMEI in Android using code

I am trying to get IMEI of a phone by running this android code

String imei="*#06#";//Checking the Phone's IMEI.
Intent cintent= new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+Uri.encode(imei)));
startActivity(cintent);

I have set the permission as required

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

But am getting this feedback on my phone "Connection problem or invalid MMI code". Where did I go wrong? Thanks

A simple change of this line did the magic. From

    Intent.ACTION_CALL 

TO:

    Intent.ACTION_DIAL

Thanks

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