IMEI号,IESI号,手机型号:

private void getInfo() {               TelephonyManager mTm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);               String imei = mTm.getDeviceId();               String imsi = mTm.getSubscriberId();               String mtype = android.os.Build.MODEL; // 手机型号               String numer = mTm.getLine1Number(); // 手机号码,有的可得,有的不可得           }

手机型号 Build.MODEL

String MODEL The end-user-visible name for the end product.

sdk版本 Build.VERSION.SDK

String SDK This constant is deprecated. UseSDK_INTto easily get this as an integer.

及frimware版本号(系统版本号)Build.VERSION.RELEASE

String RELEASE The user-visible version string.

事实上,Build能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。

String BOARD The name of the underlying board, like "goldfish".
String BOOTLOADER The system bootloader version number.
String BRAND The brand (e.g., carrier) the software is customized for, if any.
String CPU_ABI The name of the instruction set (CPU type + ABI convention) of native code.
String CPU_ABI2 The name of the second instruction set (CPU type + ABI convention) of native code.
String DEVICE The name of the industrial design.
String DISPLAY A build ID string meant for displaying to the user
String FINGERPRINT A string that uniquely identifies this build.
String HARDWARE The name of the hardware (from the kernel command line or /proc).
String HOST
String ID Either a changelist number, or a label like "M4-rc20".
String MANUFACTURER The manufacturer of the product/hardware.
String MODEL The end-user-visible name for the end product.
String PRODUCT The name of the overall product.
String RADIO The radio firmware version number.
String SERIAL A hardware serial number, if available.
String TAGS Comma-separated tags describing the build, like "unsigned,debug".
long TIME
String TYPE The type of build, like "user" or "eng".
String UNKNOWN Value used for when a build property is unknown.
String USER

明确几个概念:

SIM卡存储的数据可分为四类:

第一类是固定存放的数据。这类数据在移动电话机被出售之前由SIM卡中心写入,包括国际移动用户识别号(IMSI)、鉴权密钥(KI)、鉴权和加密算法等等。

第二类是暂时存放的有关网络的数据。如位置区域识别码(LAI)、移动用户暂时识别码(TMSI)、禁止接入的公共电话网代码等。

第三类是相关的业务代码,如个人识别码(PIN)、解锁码(PUK)、计费费率等。

第四类是电话号码簿,是手机用户随时输入的电话号码。用户全部资料几乎都存储在SIM卡内,因此SIM卡又称为用户资料识别卡。

IMSI是一个唯一的数字, 标识了GSM和UMTS网络里的唯一一个用户.它存储 在手机的SIM卡里,它会通过手机发送到网络上.IMSI与SIM唯一对应

IMEI也是一串唯一的数字, 标识了GSM和UMTS网络里的唯一一个手机.它通常被打印在手机里电池下面的那一面,拨*#06#也能看到它.IMEI与设备唯一对应.

1。IMEI不存在于SIM卡中,它是手机本身的串号。
2。通常我们所说的手机号也不存在于SIM卡中,虽然SIM卡中有一个专门存储SIM卡本身号码的地方,但是此号码是通过手工设定的,而且是可以更改的。SIM卡的识别通常使用IMSI号,这个对于SIM卡是唯一的。
3。使用SimGetRecordInfo之类的函数获得SIM卡的IMSI号码能否成功依赖于设备制造商是否实现了此函数,据我所知在DOPOD的机器上是可以获得,但是在联想的机器上却不行,其他机器没有。
4。获得IMEI以及IMSI可以通过RIL或者TAPI中的LINE操作的函数获得。


记得添加权限:

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


获取手机屏幕高度:

private void getWeithAndHeight(){              //这种方式在service中无法使用,              DisplayMetrics dm = new DisplayMetrics();              getWindowManager().getDefaultDisplay().getMetrics(dm);              String width = dm.widthPixels;              //宽              String height = dm.heightPixels;           //高                     //在service中也能得到高和宽              WindowManager mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);              width = mWindowManager.getDefaultDisplay().getWidth();              height = mWindowManager.getDefaultDisplay().getHeight();          }


获取手机MAC地址:

private String getMacAddress(){               String result = "";               WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);               WifiInfo wifiInfo = wifiManager.getConnectionInfo();               result = wifiInfo.getMacAddress();               Log.i(TAG, "macAdd:" + result);               return result;       }

手机CPU信息

private String[] getCpuInfo() {               String str1 = "/proc/cpuinfo";               String str2 = "";               String[] cpuInfo = {"", ""};  //1-cpu型号  //2-cpu频率               String[] arrayOfString;               try {                   FileReader fr = new FileReader(str1);                   BufferedReader localBufferedReader = new BufferedReader(fr, 8192);                   str2 = localBufferedReader.readLine();                   arrayOfString = str2.split("\\s+");                   for (int i = 2; i < arrayOfString.length; i++) {                       cpuInfo[0] = cpuInfo[0] + arrayOfString[i] + " ";                   }                   str2 = localBufferedReader.readLine();                   arrayOfString = str2.split("\\s+");                   cpuInfo[1] += arrayOfString[2];                   localBufferedReader.close();               } catch (IOException e) {               }               Log.i(TAG, "cpuinfo:" + cpuInfo[0] + " " + cpuInfo[1]);               return cpuInfo;           }

获取手机可用内存和总内存:

private String[] getTotalMemory() {              String[] result = {"",""};  //1-total 2-avail              ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();                mActivityManager.getMemoryInfo(mi);                long mTotalMem = 0;              long mAvailMem = mi.availMem;              String str1 = "/proc/meminfo";              String str2;              String[] arrayOfString;              try {                  FileReader localFileReader = new FileReader(str1);                  BufferedReader localBufferedReader = new BufferedReader(localFileReader, 8192);                  str2 = localBufferedReader.readLine();                  arrayOfString = str2.split("\\s+");                  mTotalMem = Integer.valueOf(arrayOfString[1]).intValue() * 1024;                  localBufferedReader.close();              } catch (IOException e) {                  e.printStackTrace();              }              result[0] = Formatter.formatFileSize(this, mTotalMem);              result[1] = Formatter.formatFileSize(this, mAvailMem);              Log.i(TAG, "meminfo total:" + result[0] + " used:" + result[1]);              return result;          }

获取手机安装的应用信息(排除系统自带):

private String getAllApp() {               String result = "";               List<PackageInfo> packages = getPackageManager().getInstalledPackages(0);               for (PackageInfo i : packages) {                   if ((i.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {                       result += i.applicationInfo.loadLabel(getPackageManager()).toString() + ",";                   }               }               return result.substring(0, result.length() - 1);       }



更多相关文章

  1. 《android关于WIFI的操作》
  2. Android获取屏幕分辨率和dpi
  3. 实现调用Android手机的拍照功能
  4. android截屏
  5. Android(安卓)通过经纬度获取地理位置信息
  6. Android(安卓)文件打开方式
  7. android典型代码系列(二十二)------按键使上面的EditText抖动
  8. Android获取文件的MD5值
  9. android获取屏幕大小

随机推荐

  1. 原创 | NOTPETYA勒索软件三年记---OT/ICS
  2. 数据组织核心技术
  3. 云服务让HPC死而复生
  4. 闲聊腾讯云
  5. 原创 | KUKA机器人安全分析实战
  6. 原创 | 2019年工控行业网络安全事件回顾
  7. 似懂非懂Google TPU
  8. 马云和他的太极生意
  9. 原创 | 5G场景下物联网海量设备安全接入
  10. 智慧交通首个|海信SC6101道路交通信号机