017 Android 获取手机SIM卡序列号和读取联系人

1.获取手机SIM卡序列号

//5.存储sim卡系列号
//5.1获取sim卡系列号
TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
//以下if内容为自动生成
     if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
             return;
      }
 String simSerialNumber=manager.getSimSerialNumber();

猜你喜欢

转载自www.cnblogs.com/luckyplj/p/10823350.html
017