获取Android唯一设备号
来源:互联网 发布:床单淘宝店知乎 编辑:程序博客网 时间:2024/05/23 02:04
public class SystemPropertiesInvoke {
private static final String TAG = “SystemPropertiesInvoke”;
private static Method getLongMethod = null;
private static Method getBooleanMethod = null;
public static long getLong(final String key, final long def) { try { if (getLongMethod == null) { getLongMethod = Class.forName("android.os.SystemProperties") .getMethod("getLong", String.class, long.class); } return ((Long) getLongMethod.invoke(null, key, def)).longValue(); } catch (Exception e) { Log.e(TAG, "Platform error: " + e.toString()); return def; }}public static boolean getBoolean(final String key, final boolean def) { try { if (getBooleanMethod == null) { getBooleanMethod = Class.forName("android.os.SystemProperties") .getMethod("getBoolean", String.class,boolean.class); }
return (Boolean)getBooleanMethod.invoke(null, key, def);
} catch (Exception e) {
Log.e(TAG, “Platform error: ” + e.toString());
return def;
}
}
public static String getString(final String key, final String def) { try { if (getBooleanMethod == null) { getBooleanMethod = Class.forName("android.os.SystemProperties") .getMethod("getString", String.class,boolean.class); }return (String)getBooleanMethod.invoke(null, key, def); } catch (Exception e) { Log.e(TAG, "Platform error: " + e.toString()); return def; }}
}
调用方式
String serial = SystemPropertiesInvoke.getString(“gsm.serial”, “”);
Log.i(“TAG”, “serial==========” + serial);
请求权限
0 0
- Android获取唯一设备号
- 获取Android唯一设备号
- 获取Android设备唯一号
- Android获取设备唯一ID
- android获取设备唯一标示
- 获取Android设备唯一识别码
- android获取设备唯一标识符
- Android设备获取唯一标识符
- android 获取设备唯一标识
- Android设备获取唯一识别码
- Android 获取设备唯一标识
- Android获取设备唯一标识
- Android 获取设备唯一ID
- Android获取设备唯一标识
- Android 获取设备唯一编号
- 获取Android设备唯一标识
- android获取设备唯一标识
- Android 获取设备唯一识别码
- windows10 如何给应用程序设置快捷键及一些常用好玩快捷键
- 数据类型运算
- Android按键长按与短按事件
- Android蓝牙4.0之玩爆智能穿戴、家具(二)【进阶篇】
- UVa 213:Message Decoding
- 获取Android唯一设备号
- C指针
- c/c++学习 No.1 位运算的学习
- Docker基础原理
- POJ 3069 Saruman's Army
- Windows内核编程学习笔记
- Spring+SpringMVC+Hiberate+MySql+Bootstrap实现一个简单验证登录实例
- 打印菱形与空心菱形java
- mapper代理开发方法