<uses-permission
android:name="android.permission.INTERNET" />
<!-- 获取机型信息权限 -->
<uses-permission
android:name="android.permission.READ_PHONE_STATE" />
<!-- 获取短信发送权限 -->
<uses-permission
android:name="android.permission.SEND_SMS" />
package com.mc;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.widget.TextView;
public class TelManager extends Activity {
TextView textView01 = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textView01 = (TextView) this.findViewById(R.id.textView01);
// getPhoneNumber();
fetch_status();
System.out.println("-------------------onCreate");
}
public void getPhoneNumber() {
// 获取手机号、手机串号信息
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getDeviceId();
String tel = tm.getLine1Number();
textView01.setText("手机串号:" + imei + "\n" + "手机号:" + tel + "\n");
}
public void fetch_status() {
TelephonyManager tm = (TelephonyManager) this
.getSystemService(Context.TELEPHONY_SERVICE);//
String str = "";
str += "DeviceId(IMEI) = " + tm.getDeviceId() + "\n";
str += "DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion()
+ "\n";
str += "Line1Number = " + tm.getLine1Number() + "\n";
str += "NetworkCountryIso = " + tm.getNetworkCountryIso() + "\n";
str += "NetworkOperator = " + tm.getNetworkOperator() + "\n";
str += "NetworkOperatorName = " + tm.getNetworkOperatorName() + "\n";
str += "NetworkType = " + tm.getNetworkType() + "\n";
str += "honeType = " + tm.getPhoneType() + "\n";
str += "SimCountryIso = " + tm.getSimCountryIso() + "\n";
str += "SimOperator = " + tm.getSimOperator() + "\n";
str += "SimOperatorName = " + tm.getSimOperatorName() + "\n";
str += "SimSerialNumber = " + tm.getSimSerialNumber() + "\n";
str += "SimState = " + tm.getSimState() + "\n";
str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";
textView01.setText(str);
}
}
在Android中以上机型信息在手机状态Status里
Settings->About Phone->Status
各个栏目的功能介绍如下:
Battery status:电池充电/未充电状态
Battery level:电池剩余电量
Phone number:手机序列号
Network:所处的移动网络
Signal strength:信号度
Network type:网络制式
Service state:所在服务区
Roaming:漫游/未漫游
Data access:共访问的数据大小
IMEI:IMEI码
IMEI SV:IMEI码的版本
IMSI:国际移动用户识别码
Wi-Fi Mac address:G1无线Wi-Fi网络的Mac地址。
Bluetooth address:蓝牙地址
Up time:正常运行时间
Awake Time:手机唤醒时间