简体   繁体   English

动态获取Android供电设备的供应商ID

[英]Get Vendor ID of Android powered device dynamically

I want to get the Vendor ID of my Android Device through my code. 我想通过我的代码获取我的Android设备的Vendor ID

I have read this: http://developer.android.com/tools/device.html , but it does not tell you how to retrieve it through code. 我已经读过这个: http//developer.android.com/tools/device.html ,但它没有告诉你如何通过代码检索它。

I have even searched in android.os.Build.<attributes> but none of them gives the VendorID . 我甚至在android.os.Build.<attributes>搜索过,但没有一个给出VendorID

Can any one tell me? 任何人都可以告诉我吗?

If you are running Ubuntu/Linux just type in terminal lsusb -v and press enter. 如果您正在运行Ubuntu / Linux,只需输入终端lsusb -v并按Enter键。 It will bring out details of all USB devices. 它将显示所有USB设备的详细信息。 Check for a field called idVendor in the results and find your device. 在结果中检查名为idVendor的字段并找到您的设备。

Eg my Motorola Defy (vendor id = 22b8) gives: 例如,我的摩托罗拉Defy(供应商ID = 22b8)给出:

idVendor           0x22b8 Motorola PCS

may be android.os.Build.MANUFACTURER is what you are looking for.. 可能是android.os.Build.MANUFACTURER是你要找的..

There is also one more field called brand android.os.Build.BRAND which specify The brand (eg, carrier) the software is customized for, if any. 还有一个名为android.os.Build.BRAND的字段指定了软件定制的品牌(例如,运营商),如果有的话。

You can also try our Phone Info app from app store to check these value on your device. 您还可以从应用商店尝试我们的手机信息应用,以检查您设备上的这些价值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM