核心代码:
Imei = ((TelephonyManager) getSystemService(TELEPHONY_SERVICE))
.getDeviceId();
1.加入权限
在manifest.xml文件中要添加 <uses-permission android:name="android.permission.READ_PHONE_STATE" />
2.代码
/**
*
*@author dingran
*创建日期 2010-4-29 下午05:02:47
*
*/
package net.sunniwell.app;
import android.app.Activity;
import android.os.Bundle;
import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
public class TelManager extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TelephonyManager tm = (TelephonyManager) this.getSystemService(TELEPHONY_