android之获取手机IMEI、IMSI码

/**

* 获取手机IMEI码

* @param context

* @return

*/

public static String getIMEI(Context context) {

TelephonyManager tm = (TelephonyManager) context.getSystemService(Activity.TELEPHONY_SERVICE);

String imei = tm.getDeviceId();

if (imei == null)

imei = "";

return imei;

}

 

/**

* 获取手机IMSI码

* @param context

* @return

*/

public static String getIMSI(Context context) {

TelephonyManager tm = (TelephonyManager) context.getSystemService(Activity.TELEPHONY_SERVICE);

String imsi = tm.getSubscriberId();

if (imsi == null)

imsi = "";

return imsi;

}

posted @ 2014-03-12 21:12  下一次ai微笑  阅读(1499)  评论(0编辑  收藏  举报