【问题标题】:How to get the name of the device printed with adb devices?如何获取使用 adb devices 打印的设备名称?
【发布时间】:2012-05-06 00:38:58
【问题描述】:

当我输入时

adb devices

在控制台中,然后打印:

List of devices attached 
SH16BV815282    device

如果可能的话,我如何以编程方式获取SH16BV815282

我想在运行时通过 android 应用程序获取该值。这个值实际存储在哪里?

【问题讨论】:

    标签: android shell device adb


    【解决方案1】:

    它是Build.SERIAL。但是,它仅适用于 Android 2.3+。

    【讨论】:

    • 所以在 2.3 下我看不懂这个?,是否有一些 ACL(比如片段)可以委托读取这个值?
    • 不,至少不是以非常骇人听闻的方式。对于 hackish 方式,请参阅 Yashwanth Kumar 的答案中的第二个链接。
    • adb devices 和 Build.SERIAL 在我的带有 android 3.2 的 Galaxy Tab 10.1 上给出了非常不同的结果
    • Build.SERIAL 在 Galaxy S(操作系统版本 2.3.3)上给出“未知”。
    【解决方案2】:

    我正在使用打击代码来获取设备的名称。

    GUIStatics.deviceModel = android.os.Build.MODEL;

    【讨论】:

      猜你喜欢
      • 2012-02-04
      • 2015-12-26
      • 1970-01-01
      • 2015-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-27
      相关资源
      最近更新 更多