public class MyApplication extends Application {
public static final String TAG = "MyApplication";
private static MyApplication instance=null;
public MyApplication() {
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
instance=this;
}
/**
* 获取一个实例
*/
public static MyApplication getinstance() {
if(instance==null){
instance=new MyApplication();
}
return instance;
}
}
*****************************************************************
public class Utils {
/**
* 获取手机串号
*/
public static String getPhoneSN() {
TelephonyManager telmanage = (TelephonyManager) MyApplication.getinstance()
.getSystemService(Context.TELEPHONY_SERVICE);
String deviceId = telmanage.getDeviceId();
Log.e("Utils", deviceId);
return deviceId;
}
为什么获取不到 IMEI 啊?