本文整理汇总了Java中android.os.Build.SERIAL属性的典型用法代码示例。如果您正苦于以下问题:Java Build.SERIAL属性的具体用法?Java Build.SERIAL怎么用?Java Build.SERIAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.Build
的用法示例。
在下文中一共展示了Build.SERIAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeviceId
public static String getDeviceId(Context context) {
String androidId = Settings.Secure.getString(context.getContentResolver(),
Settings.Secure.ANDROID_ID);
if (!TextUtils.isEmpty(androidId)) {
String serial = Build.SERIAL;
if (!"unknown".equalsIgnoreCase(serial)) {
return androidId + serial;
}
return androidId;
}
File file = new File(context.getFilesDir(), "deviceId");
file.mkdir();
File[] files = file.listFiles();
if (files.length > 0) {
return files[0].getName();
}
String id = UUID.randomUUID().toString();
(new File(file, id)).mkdir();
return id;
}
示例2: getBuildFingerprintAndDeviceSerial
private static byte[] getBuildFingerprintAndDeviceSerial() {
StringBuilder result = new StringBuilder();
String fingerprint = Build.FINGERPRINT;
if (fingerprint != null) {
result.append(fingerprint);
}
String serial = Build.SERIAL;
if (serial != null) {
result.append(serial);
}
try {
return result.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 encoding not supported");
}
}
示例3: writeToEntropyPool
@Override
protected void writeToEntropyPool(DataOutputStream out) throws IOException {
super.writeToEntropyPool(out);
out.writeInt(android.os.Process.myPid());
out.writeInt(android.os.Process.myTid());
out.writeInt(android.os.Process.myUid());
if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
ContentResolver contentResolver = appContext.getContentResolver();
String id = Settings.Secure.getString(contentResolver, ANDROID_ID);
if (id != null) out.writeUTF(id);
Parcel parcel = Parcel.obtain();
WifiManager wm =
(WifiManager) appContext.getSystemService(WIFI_SERVICE);
List<WifiConfiguration> configs = wm.getConfiguredNetworks();
if (configs != null) {
for (WifiConfiguration config : configs)
parcel.writeParcelable(config, 0);
}
BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
if (bt != null) {
for (BluetoothDevice device : bt.getBondedDevices())
parcel.writeParcelable(device, 0);
}
out.write(parcel.marshall());
parcel.recycle();
}
示例4: getDeviceDetails
public static String getDeviceDetails(Context context) {
return "Device Information\n"
+ "\nDEVICE.ID : " + getDeviceId(context)
+ "\nUSER.ID : " + getUserIdentity(context)
+ "\nAPP.VERSION : " + getAppVersion(context)
+ "\nLAUNCHER.APP : " + getCurrentLauncherApp(context)
+ "\nTIMEZONE : " + timeZone()
+ "\nVERSION.RELEASE : " + Build.VERSION.RELEASE
+ "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
+ "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
+ "\nBOARD : " + Build.BOARD
+ "\nBOOTLOADER : " + Build.BOOTLOADER
+ "\nBRAND : " + Build.BRAND
+ "\nCPU_ABI : " + Build.CPU_ABI
+ "\nCPU_ABI2 : " + Build.CPU_ABI2
+ "\nDISPLAY : " + Build.DISPLAY
+ "\nFINGERPRINT : " + Build.FINGERPRINT
+ "\nHARDWARE : " + Build.HARDWARE
+ "\nHOST : " + Build.HOST
+ "\nID : " + Build.ID
+ "\nMANUFACTURER : " + Build.MANUFACTURER
+ "\nMODEL : " + Build.MODEL
+ "\nPRODUCT : " + Build.PRODUCT
+ "\nSERIAL : " + Build.SERIAL
+ "\nTAGS : " + Build.TAGS
+ "\nTIME : " + Build.TIME
+ "\nTYPE : " + Build.TYPE
+ "\nUNKNOWN : " + Build.UNKNOWN
+ "\nUSER : " + Build.USER;
}
示例5: getDeviceSerialNumber
/**
* Gets the hardware serial number of this device.
*
* @return serial number or {@code null} if not available.
*/
private static String getDeviceSerialNumber() {
try {
return Build.SERIAL;
} catch (Exception ignored) {
return null;
}
}
示例6: getSerial
public static String getSerial() {
return Build.SERIAL;
}
示例7: getPhoneId
/**
* 获取手机的ID
*
* @return 设备ID
*/
public String getPhoneId(Context context) {
try {
return Build.SERIAL;
} catch (Exception e) {
return "";
}
}
示例8: getSerial
@TargetApi(9)
private static String getSerial() {
try {
return Build.SERIAL;
} catch (Throwable e) {
FLOG.w(TAG, "get serial failed(Throwable): " + e.getMessage());
return null;
}
}
示例9:
private void b0439й0439043904390439() {
String str = Build.SERIAL;
if (((b041EООО041EО + b041E041EОО041EО) * b041EООО041EО) % bОО041EО041EО != bО041EОО041EО) {
b041EООО041EО = b041EО041EО041EО();
bО041EОО041EО = b041EО041EО041EО();
}
this.bь044C044Cььь = str;
}
示例10: b
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);
}
示例11: getSerialNumber
public String getSerialNumber() {
String str = "";
try {
return Build.SERIAL;
} catch (Exception e) {
return str;
}
}
示例12: registerDevice
/**
* register device
*/
public void registerDevice() {
if (mqttService == null) return;
String passcode = Build.SERIAL;
if(Build.SERIAL == null) {
Log.e(TAG, "Serial is NULL!");
passcode = "12345"; //default
}
else
Log.i(TAG, "Serial is " + Build.SERIAL);
oneM2MAPI.getInstance().tpRegisterDevice(mqttService, passcode,
"3", "true", new MQTTCallback<remoteCSEResponse>() {
@Override
public void onResponse(remoteCSEResponse response) {
device = response;
registerSensor();
registerControl();
if (stateListener != null) {
stateListener.onRegistered(true, device.dKey, device.getNl());
}
}
@Override
public void onFailure(int errorCode, String message) {
Log.e(TAG, errorCode + " : " + message);
stateListener.onRegistered(false, null, null);
}
});
}
示例13: f
public String f() {
if (VERSION.SDK_INT >= 9) {
return Build.SERIAL;
}
return null;
}
示例14: getSalt
public static String getSalt(int userId) {
String def = (Build.SERIAL == null ? "" : Build.SERIAL);
return getSetting(userId, cSettingSalt, def);
}
示例15: removeLegacySalt
public static void removeLegacySalt(int userId) {
String def = (Build.SERIAL == null ? "" : Build.SERIAL);
String salt = getSetting(userId, cSettingSalt, null);
if (def.equals(salt))
setSetting(userId, cSettingSalt, null);
}