Android 获取手机串号

Context context = getWindow().getContext();       

TelephonyManager telephonemanage = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);             

  try        {    

   Toast.makeText(this, "MIEI码为:"+telephonemanage.getDeviceId(), 1000).show();     

  }   

    catch(Exception e)        {    

   Log.i("error", e.getMessage()); 

      }

而且需要在AndroidManifest.xml 加入权限才行,内容为:

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

posted @ 2014-12-21 22:09  net5x  阅读(232)  评论(0编辑  收藏  举报