作者:我的灵魂在黑夜P里徘回 | 来源:互联网 | 2023-09-23 10:26
packagecom.example.getimei;importandroid.app.Activity;importandroid.os.Bundle;importandro
快三大小单双稳赚买法package com.example.getimei;import android.app.Activity;import android.os.Bundle;import android.telephony.TelephonyManager;import android.widget.TextView;public class MainActivity extends Activity {public String imei;public String iccid;public TelephonyManager tm;public TextView textView2, textView1;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);tm = (TelephonyManager) this.getSystemService(TELEPHONY_SERVICE);//获取机器本身的IMEI号,没烧录会获取空的imei = tm.getDeviceId();//获取机器本身的ICCID号,没插卡会获取空的iccid = tm.getSimSerialNumber();textView1 = (TextView) findViewById(R.id.text1);textView2 = (TextView) findViewById(R.id.text2);textView1.setText(imei);textView2.setText(iccid);// textView1.setText(splitString(imei));// textView2.setText(ICCID(iccid));}/** 截取ICCID后五位String iccidnew = "123456";public String ICCID(String iccid) {if (iccid != null && iccid.length() >= 6) {Log.d("id", "substring" + iccid);return iccid.substring(iccid.length() - 6, iccid.length());} else if (iccid == null) {return iccid = iccidnew;}return iccid;}截取IMEI后五位public String splitString(String imei) {if (imei != null && imei.length() >= 5) {return imei.substring(imei.length() - 5, imei.length());}return "";}*/}