本文整理汇总了Java中android.telephony.TelephonyManager.getSimSerialNumber方法的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.getSimSerialNumber方法的具体用法?Java TelephonyManager.getSimSerialNumber怎么用?Java TelephonyManager.getSimSerialNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.telephony.TelephonyManager
的用法示例。
在下文中一共展示了TelephonyManager.getSimSerialNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPhoneStatus
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取手机状态信息
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return DeviceId(IMEI) = 99000311726612<br>
* DeviceSoftwareVersion = 00<br>
* Line1Number =<br>
* NetworkCountryIso = cn<br>
* NetworkOperator = 46003<br>
* NetworkOperatorName = 中国电信<br>
* NetworkType = 6<br>
* honeType = 2<br>
* SimCountryIso = cn<br>
* SimOperator = 46003<br>
* SimOperatorName = 中国电信<br>
* SimSerialNumber = 89860315045710604022<br>
* SimState = 5<br>
* SubscriberId(IMSI) = 460030419724900<br>
* VoiceMailNumber = *86<br>
*/
public static String getPhoneStatus() {
TelephonyManager tm = (TelephonyManager) Utils.getContext()
.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";
return str;
}
示例2: getPhoneStatus
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取手机状态信息
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return DeviceId(IMEI) = 99000311726612<br>
* DeviceSoftwareVersion = 00<br>
* Line1Number =<br>
* NetworkCountryIso = cn<br>
* NetworkOperator = 46003<br>
* NetworkOperatorName = 中国电信<br>
* NetworkType = 6<br>
* honeType = 2<br>
* SimCountryIso = cn<br>
* SimOperator = 46003<br>
* SimOperatorName = 中国电信<br>
* SimSerialNumber = 89860315045710604022<br>
* SimState = 5<br>
* SubscriberId(IMSI) = 460030419724900<br>
* VoiceMailNumber = *86<br>
*/
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
TelephonyManager tm = (TelephonyManager) Utils.getApp()
.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 += "PhoneType = " + 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";
return str;
}
示例3: getPhoneStatus
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取手机状态信息
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return DeviceId(IMEI) = 99000311726612<br>
* DeviceSoftwareVersion = 00<br>
* Line1Number =<br>
* NetworkCountryIso = cn<br>
* NetworkOperator = 46003<br>
* NetworkOperatorName = 中国电信<br>
* NetworkType = 6<br>
* honeType = 2<br>
* SimCountryIso = cn<br>
* SimOperator = 46003<br>
* SimOperatorName = 中国电信<br>
* SimSerialNumber = 89860315045710604022<br>
* SimState = 5<br>
* SubscriberId(IMSI) = 460030419724900<br>
* VoiceMailNumber = *86<br>
*/
@SuppressLint("HardwareIds")
public static String getPhoneStatus() {
TelephonyManager tm = (TelephonyManager) Utils.getContext()
.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 += "PhoneType = " + 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";
return str;
}
示例4: getPhoneStatus
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取手机状态信息
* <p>需添加权限 {@code <uses-permission android:name="android.permission.READ_PHONE_STATE"/>}</p>
*
* @return DeviceId(IMEI) = 99000311726612<br>
* DeviceSoftwareVersion = 00<br>
* Line1Number =<br>
* NetworkCountryIso = cn<br>
* NetworkOperator = 46003<br>
* NetworkOperatorName = 中国电信<br>
* NetworkType = 6<br>
* honeType = 2<br>
* SimCountryIso = cn<br>
* SimOperator = 46003<br>
* SimOperatorName = 中国电信<br>
* SimSerialNumber = 89860315045710604022<br>
* SimState = 5<br>
* SubscriberId(IMSI) = 460030419724900<br>
* VoiceMailNumber = *86<br>
*/
@SuppressLint("HardwareIds")
public static String getPhoneStatus(Context context) {
TelephonyManager tm = (TelephonyManager) context
.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 += "PhoneType = " + 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";
return str;
}
示例5: getUUID
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取设备唯一标识
*
* @param context
* @return
*/
public static String getUUID(Context context) {
final TelephonyManager tm = (TelephonyManager) context.getSystemService(TELEPHONY_SERVICE);
final String tmDevice, tmSerial, tmPhone, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
String uniqueId = deviceUuid.toString();
if (BuildConfig.DEBUG)
Log.d(TAG, "uuid=" + uniqueId);
return uniqueId;
}
示例6: getDeviceId
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getDeviceId(Context context) {
TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getDeviceId();
String tmDevice;
if(null != imei && !"".equals(imei)) {
tmDevice = "^[0]+$";
if(!imei.matches(tmDevice)) {
return imei;
}
}
tmDevice = "" + tm.getDeviceId();
String tmSerial = "" + tm.getSimSerialNumber();
String androidId = "" + Settings.Secure.getString(context.getContentResolver(), "android_id");
return (new UUID((long)androidId.hashCode(), (long)tmDevice.hashCode() << 32 | (long)tmSerial.hashCode())).toString();
}
示例7: getDeviceId
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getDeviceId(Context context) {
String deviceID = null;
// MAC
WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
WifiInfo info;
if (wifi != null && (info = wifi.getConnectionInfo()) != null) {
deviceID = info.getMacAddress();
}
// TelephonyManager.DeviceId
String tmSerial = "null";
if (TextUtils.isEmpty(deviceID)) {
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (tm != null) {
tmSerial = "" + tm.getSimSerialNumber();
deviceID = tm.getDeviceId();
}
}
// Settings.Secure.ANDROID_ID + TelephonyManager.SimSerialNumber
if (TextUtils.isEmpty(deviceID)) {
deviceID = generateId(context, tmSerial);
}
return deviceID;
}
示例8: getSimSerialNumber
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String getSimSerialNumber(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (tm == null) {
return "";
}
return "" + tm.getSimSerialNumber();
}
示例9: deviceId
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public static String deviceId(Context context) {
final TelephonyManager tm =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(),
((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
return deviceUuid.toString();
}
示例10: getUDID
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
@SuppressLint("HardwareIds")
public static String getUDID(Activity activity) {
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
String tmDevice = "" + tm.getDeviceId();
String tmSerial = "" + tm.getSimSerialNumber();
String androidId = "" + Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
return deviceUuid.toString();
}
else{
return Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID);
}
}
示例11: getApplicationInfo
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
private void getApplicationInfo() {
final PackageManager pm = mContext.getPackageManager();
try {
final PackageInfo pi = pm.getPackageInfo(mContext.getPackageName(),
0);
versionName = pi.versionName;
versionCode = pi.versionCode;
final ApplicationInfo ai = pm.getApplicationInfo(
mContext.getPackageName(), PackageManager.GET_META_DATA);
channelName = ai.metaData.get("UMENG_CHANNEL").toString();
channelId = STIDUtil.getChannelIdByChannelName(channelName);
debugType = ai.metaData.get("app_debug").toString();
if ("1".equals(debugType)) {
// developer mode
isDebug = true;
} else if ("0".equals(debugType)) {
// release mode
isDebug = false;
}
LogUtils.allow = isDebug;
appName = String.valueOf(ai.loadLabel(pm));
LogUtils.appTagPrefix = appName;
packageName = mContext.getPackageName();
TelephonyManager telMgr = (TelephonyManager) mContext
.getSystemService(Context.TELEPHONY_SERVICE);
imei = telMgr.getDeviceId();
sim = telMgr.getSimSerialNumber();
} catch (NameNotFoundException e) {
Log.d(TAG, "met some error when get application info");
}
}
示例12: getUDID
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
@SuppressLint("HardwareIds")
public static String getUDID(Activity activity) {
if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
String tmDevice = "" + (tm != null ? tm.getDeviceId() : null);
String tmSerial = "" + (tm != null ? tm.getSimSerialNumber() : null);
String androidId = "" + Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
return deviceUuid.toString();
}
else{
return Settings.Secure.getString(activity.getContentResolver(), Settings.Secure.ANDROID_ID);
}
}
示例13: getDeviceUUID
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取设备序列号
*
* @return Str
*/
public static String getDeviceUUID() {
final TelephonyManager tm = (TelephonyManager) App.getDefault().getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(App.getDefault().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
String uniqueId = deviceUuid.toString();
return uniqueId;
}
示例14: getUUID
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
/**
* 获取手机UUID
*/
public static String getUUID(Context context) {
if (android.text.TextUtils.isEmpty(uuid)) {
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, tmPhone, androidId;
tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode());
uuid = deviceUuid.toString();
}
return uuid;
}
示例15: b
import android.telephony.TelephonyManager; //导入方法依赖的package包/类
public void b(Context context) {
String simSerialNumber;
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
try {
String deviceId = telephonyManager.getDeviceId();
if (deviceId != null) {
this.a = UUID.nameUUIDFromBytes(deviceId.getBytes("UTF-8")).toString();
}
} catch (Exception e) {
PingppLog.a(e.getMessage());
}
try {
simSerialNumber = telephonyManager.getSimSerialNumber();
if (simSerialNumber != null) {
this.c = UUID.nameUUIDFromBytes(simSerialNumber.getBytes("UTF-8")).toString();
}
} catch (Exception e2) {
PingppLog.a(e2.getMessage());
}
try {
simSerialNumber = Secure.getString(context.getContentResolver(), "android_id");
if (!(simSerialNumber == null || "9774d56d682e549c".equals(simSerialNumber))) {
this.b = UUID.nameUUIDFromBytes(simSerialNumber.getBytes("UTF-8")).toString();
}
} catch (Exception e22) {
PingppLog.a(e22.getMessage());
}
try {
simSerialNumber = Build.SERIAL;
if (simSerialNumber != null) {
this.d = UUID.nameUUIDFromBytes(simSerialNumber.getBytes("UTF-8")).toString();
}
} catch (Exception e222) {
PingppLog.a(e222.getMessage());
}
PingppLog.a("deviceId: " + this.a + "\nandroidId: " + this.b + "\nsimSerialNum: " + this
.c + "\nserialNum: " + this.d);
}