如何让Android的联想标签的实际序列号 [英] How to get real serial number of lenovo tab in android

查看:331
本文介绍了如何让Android的联想标签的实际序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让机器人在我的联想Idea Tab键的序列号。我试着在谷歌搜索所有可用选项这是

I am trying to get serial number of my lenovo Idea Tab in android. I tried all the options available in Google search which are

C类=的Class.forName(android.os.SystemProperties);

Class c = Class.forName("android.os.SystemProperties");

方法获取= c.getMethod(获取,为String.class);

Method get = c.getMethod("get", String.class);

字符串序列=(字符串)get.invoke(C,ril.serialnumber);

String serial = (String) get.invoke(c, "ril.serialnumber" );

字符串serial_no =(字符串)get.invoke(C,ro.serialno);

String serial_no = (String) get.invoke(c, "ro.serialno");

字符串serial_no1 =(字符串)get.invoke(C,sys.serialnumber);

String serial_no1 = (String) get.invoke(c, "sys.serialnumber");

ro.serialno是给一个值作为8TYDE67HYLUOZPOZ,而是平板在岗位没有示出的串行>是HGC2TKH4并在标签的背面侧的印刷的序列号也HGC2TKH4

ro.serialno is giving a value as 8TYDE67HYLUOZPOZ, but the serial no shown in status-> about Tablet is HGC2TKH4 and the printed serial number in the back side of the tab is also HGC2TKH4.

ril.serialnumber和sys.serialnumber是空的。

ril.serialnumber and sys.serialnumber is empty.

在一些其他标签还可以,ril.serialnumber是空的,但它应该有序列号,希望

In some other tabs also , the ril.serialnumber is empty, but it supposed to have the serial number , I hope.

请帮我找到我的Andr​​oid设备的实际序列号。
谢谢

Please help me to find the real serial number of my device in android. Thanks

推荐答案

最近,我也得到了联想平板的SN。
您可以使用以下方法

I recently had to also get the SN for a lenovo tablet. You can use the following methods

public static String getIMEI(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager != null ? (telephonyManager.getDeviceId() != null ? telephonyManager.getDeviceId() : "N/A") : "N/A";
}

public static String getSN() {
    String deviceSN = "N/A";
    try {
        Class<?> propClass = Class.forName("android.os.SystemProperties");
        Method getProp = propClass.getMethod("get", String.class, String.class);
        deviceSN = (String) getProp.invoke(propClass, "gsm.sn1", "N/A");
    } catch (Exception ignored) {
    }
    return deviceSN;
}

public static String getPN() {
    String devicePN = "N/A";
    try {
        Class<?> propClass = Class.forName("android.os.SystemProperties");
        Method getProp = propClass.getMethod("get", String.class, String.class);
        devicePN = (String) getProp.invoke(propClass, "ro.lenovosn2", "N/A");
    } catch (Exception ignored) {
    }
    return devicePN;
}

联想有自定义属性的名称,可以使用下面的ADB命令来查看所有可用的道具:

Lenovo has custom property names, you can use the following adb command to see all available props:

adb shell getprop

这篇关于如何让Android的联想标签的实际序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆