TelephonyManager有什么信息

这是模拟器上的信息:

01-29 02:42:41.962: V/PhoneInfo(1002): DeviceID = 000000000000000
01-29 02:42:41.992: V/PhoneInfo(1002): DeviceSoftwareVer = null
01-29 02:42:41.992: V/PhoneInfo(1002): Line1Number = 15555215554
01-29 02:42:41.992: V/PhoneInfo(1002): NetworkCountryIso = us
01-29 02:42:41.992: V/PhoneInfo(1002): NetworkOperator = 310260
01-29 02:42:41.992: V/PhoneInfo(1002): NetworkOperatorName = Android
01-29 02:42:41.992: V/PhoneInfo(1002): NetworkType = 3
01-29 02:42:41.992: V/PhoneInfo(1002): PhoneType = 1
01-29 02:42:42.002: V/PhoneInfo(1002): SimCountryIso = us
01-29 02:42:42.002: V/PhoneInfo(1002): SimOperator = 310260
01-29 02:42:42.002: V/PhoneInfo(1002): SimOperatorName = Android
01-29 02:42:42.002: V/PhoneInfo(1002): SimSerialNumber = 89014103211118510720
01-29 02:42:42.002: V/PhoneInfo(1002): SimState = 5
01-29 02:42:42.002: V/PhoneInfo(1002): SubscriberId = 310260000000000
01-29 02:42:42.002: V/PhoneInfo(1002): VoiceMailAlphaTag = Voicemail
01-29 02:42:42.002: V/PhoneInfo(1002): VoiceMailNumber = +15552175049
01-29 02:42:42.002: V/PhoneInfo(1002): ----------------------------------------------------------------
01-29 02:42:42.002: V/PhoneInfo(1002): Build.VERSION.Codename = REL
01-29 02:42:42.002: V/PhoneInfo(1002): Build.VERSION.Incremental = 43546
01-29 02:42:42.012: V/PhoneInfo(1002): Build.VERSION.Release = 2.2
01-29 02:42:42.012: V/PhoneInfo(1002): Build.VERSION.SdkInt = 8
01-29 02:42:42.012: V/PhoneInfo(1002): Build.Device = generic
01-29 02:42:42.012: V/PhoneInfo(1002): Build.Display = google_sdk-eng 2.2 FRF91 43546 test-keys
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Fingerprint = generic/google_sdk/generic/:2.2/FRF91/43546:eng/test-keys
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Hardware = goldfish
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Host = e-honda.mtv.corp.google.com
01-29 02:42:42.022: V/PhoneInfo(1002): Build.ID = FRF91
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Manufacturer = unknown
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Model = google_sdk
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Product = google_sdk
01-29 02:42:42.022: V/PhoneInfo(1002): Build.Type = eng
01-29 02:42:42.033: V/PhoneInfo(1002): Build.User = android-build

这是手机上获得的信息:

01-29 10:44:11.319: V/PhoneInfo(15919): DeviceID = 35651304127****
01-29 10:44:11.319: V/PhoneInfo(15919): DeviceSoftwareVer = 356513041279****
01-29 10:44:11.319: V/PhoneInfo(15919): Line1Number = 
01-29 10:44:11.319: V/PhoneInfo(15919): NetworkCountryIso = cn
01-29 10:44:11.319: V/PhoneInfo(15919): NetworkOperator = 46000
01-29 10:44:11.319: V/PhoneInfo(15919): NetworkOperatorName = 中国移动
01-29 10:44:11.319: V/PhoneInfo(15919): NetworkType = 2
01-29 10:44:11.319: V/PhoneInfo(15919): PhoneType = 1
01-29 10:44:11.319: V/PhoneInfo(15919): SimCountryIso = cn
01-29 10:44:11.319: V/PhoneInfo(15919): SimOperator = 46000
01-29 10:44:11.319: V/PhoneInfo(15919): SimOperatorName = 
01-29 10:44:11.319: V/PhoneInfo(15919): SimSerialNumber = 8986008019031505****
01-29 10:44:11.319: V/PhoneInfo(15919): SimState = 5
01-29 10:44:11.319: V/PhoneInfo(15919): SubscriberId = 46000886810****
01-29 10:44:11.319: V/PhoneInfo(15919): VoiceMailAlphaTag = 语音信箱
01-29 10:44:11.319: V/PhoneInfo(15919): VoiceMailNumber = null
01-29 10:44:11.319: V/PhoneInfo(15919): ----------------------------------------------------------------
01-29 10:44:11.319: V/PhoneInfo(15919): Build.VERSION.Codename = REL
01-29 10:44:11.319: V/PhoneInfo(15919): Build.VERSION.Incremental = 1318359360
01-29 10:44:11.319: V/PhoneInfo(15919): Build.VERSION.Release = 2.3.6
01-29 10:44:11.319: V/PhoneInfo(15919): Build.VERSION.SdkInt = 10
01-29 10:44:11.319: V/PhoneInfo(15919): Build.Device = umts_jordan
01-29 10:44:11.319: V/PhoneInfo(15919): Build.Display = 4.5.1-134_DFP-137
01-29 10:44:11.319: V/PhoneInfo(15919): Build.Fingerprint = MOTO/MB526_RTNORD/umts_jordan:2.3.6/4.5.1-134_DFP-137/1318359360:user/release-keys
01-29 10:44:11.319: V/PhoneInfo(15919): Build.Hardware = mapphone_umts
01-29 10:44:11.319: V/PhoneInfo(15919): Build.Host = il93lnxdroid54
01-29 10:44:11.319: V/PhoneInfo(15919): Build.ID = 4.5.1-134_DFP-137
01-29 10:44:11.319: V/PhoneInfo(15919): Build.Manufacturer = motorola
01-29 10:44:11.342: V/PhoneInfo(15919): Build.Model = MB526
01-29 10:44:11.342: V/PhoneInfo(15919): Build.Product = MB526_RTNORD
01-29 10:44:11.342: V/PhoneInfo(15919): Build.Type = user
01-29 10:44:11.342: V/PhoneInfo(15919): Build.User = hudsoncm


这是程序代码(MainActivity.java):

package com.example.phoneinfo;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		initInfoList();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	
	private void initInfoList() {
		TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
		
		List<String> infos = new ArrayList<String>();
		
		infos.add("DeviceID = " + tm.getDeviceId());
		infos.add("DeviceSoftwareVer = " + tm.getDeviceSoftwareVersion());
		infos.add("Line1Number = " + tm.getLine1Number());
		infos.add("NetworkCountryIso = " + tm.getNetworkCountryIso());
		infos.add("NetworkOperator = " + tm.getNetworkOperator());
		infos.add("NetworkOperatorName = " + tm.getNetworkOperatorName());
		infos.add("NetworkType = " + tm.getNetworkType());
		infos.add("PhoneType = " + tm.getPhoneType());
		infos.add("SimCountryIso = " + tm.getSimCountryIso());
		infos.add("SimOperator = " + tm.getSimOperator());
		infos.add("SimOperatorName = " + tm.getSimOperatorName());
		infos.add("SimSerialNumber = " + tm.getSimSerialNumber());
		infos.add("SimState = " + tm.getSimState());
		infos.add("SubscriberId = " + tm.getSubscriberId());
		infos.add("VoiceMailAlphaTag = " + tm.getVoiceMailAlphaTag());
		infos.add("VoiceMailNumber = " + tm.getVoiceMailNumber());
		
		infos.add("----------------------------------------------------------------");
		
		infos.add("Build.VERSION.Codename = " + Build.VERSION.CODENAME);
		infos.add("Build.VERSION.Incremental = " + Build.VERSION.INCREMENTAL);
		infos.add("Build.VERSION.Release = " + Build.VERSION.RELEASE);
		infos.add("Build.VERSION.SdkInt = " + Build.VERSION.SDK_INT);
		infos.add("Build.Device = " + Build.DEVICE);
		infos.add("Build.Display = " + Build.DISPLAY);
		infos.add("Build.Fingerprint = " + Build.FINGERPRINT);
		infos.add("Build.Hardware = " + Build.HARDWARE);
		infos.add("Build.Host = " + Build.HOST);
		infos.add("Build.ID = " + Build.ID);
		infos.add("Build.Manufacturer = " + Build.MANUFACTURER);
		infos.add("Build.Model = " + Build.MODEL);
		infos.add("Build.Product = " + Build.PRODUCT);
		infos.add("Build.Type = " + Build.TYPE);
		infos.add("Build.User = " + Build.USER);
		
		ListView listView = (ListView) findViewById(R.id.infoListView);		
		listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_2, android.R.id.text2, infos));
		
		for (String line:infos)
			Log.v("PhoneInfo", line);
	}
}


要想程序正常执行,必须在Manifest.xml加上权限:

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

你可能感兴趣的:(TelephonyManager有什么信息)