Android:以编程方式获取硬件信息

我需要在运行我的应用程序的Android设备上获取与硬件相关的信息。 我需要以下信息。

  • CPU制造商,型号和序列号
  • SD卡制造商和序列号
  • 相机制造商及其他相关规格
  • 蓝牙相关的硬件信息
  • WiFi相关的硬件信息
  • RAM供应商/型号
  • 显示供应商和型号

对此主题的任何帮助将不胜感激。

Heshan Perera asked 2020-08-01T11:24:07Z
5个解决方案
35 votes
Log.i("ManuFacturer :", Build.MANUFACTURER);
Log.i("Board : ", Build.BOARD);
Log.i("Display : ", Build.DISPLAY);

可以在[http://developer.android.com/reference/android/os/Build.html]中找到更多信息。

Richa answered 2020-08-01T11:24:24Z
27 votes
    Log.i("TAG", "SERIAL: " + Build.SERIAL);
    Log.i("TAG","MODEL: " + Build.MODEL);
    Log.i("TAG","ID: " + Build.ID);
    Log.i("TAG","Manufacture: " + Build.MANUFACTURER);
    Log.i("TAG","brand: " + Build.BRAND);
    Log.i("TAG","type: " + Build.TYPE);
    Log.i("TAG","user: " + Build.USER);
    Log.i("TAG","BASE: " + Build.VERSION_CODES.BASE);
    Log.i("TAG","INCREMENTAL " + Build.VERSION.INCREMENTAL);
    Log.i("TAG","SDK  " + Build.VERSION.SDK);
    Log.i("TAG","BOARD: " + Build.BOARD);
    Log.i("TAG","BRAND " + Build.BRAND);
    Log.i("TAG","HOST " + Build.HOST);
    Log.i("TAG","FINGERPRINT: "+Build.FINGERPRINT);
    Log.i("TAG","Version Code: " + Build.VERSION.RELEASE);
Yamini answered 2020-08-01T11:24:40Z
7 votes

**此代码为您提供有关以下内容的信息**

  1. 设备制造商
  2. 模型
  3. 硬件
  4. 序列号。
  5. Android_ID
  6. 屏幕分辨率
  7. 屏幕密度
  8. 引导加载程序
  9. 用户
  10. 主办
  11. API级别
  12. 内部编号
  13. 建立时间
  14. 指纹

        DisplayMetrics dm = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
        double x = Math.pow(mWidthPixels / dm.xdpi, 2);
        double y = Math.pow(mHeightPixels / dm.ydpi, 2);
        screenInches = Math.sqrt(x + y);
        rounded = df2.format(screenInches);
        densityDpi = (int) (dm.density * 160f);
    
    
    
    
    Manufacturer_value = Build.MANUFACTURER;
    Brand_value = Build.BRAND;
    Model_value = Build.MODEL;
    Board_value = Build.BOARD;
    Hardware_value = Build.HARDWARE;
    Serial_nO_value = Build.SERIAL;
    UID_value = tManager.getDeviceId();
    android_id = 
    Settings.Secure.getString(getContext().getContentResolver(), 
    Settings.Secure.ANDROID_ID);
    ScreenResolution_value = mHeightPixels + " * " + mWidthPixels + " Pixels";
    screen_size = rounded + " Inches";
    screen_density = String.valueOf(densityDpi) + " dpi";
    BootLoader_value = Build.BOOTLOADER;
    User_value = Build.USER;
    Host_value = Build.HOST;
    Version = Build.VERSION.RELEASE;
    API_level = Build.VERSION.SDK_INT + "";
    Build_ID = Build.ID;
    Build_Time = Build.TIME + "";
    Fingerprint = Build.FINGERPRINT;
    
M Talha answered 2020-08-01T11:26:08Z
6 votes

您还可以获取实时硬件信息。 在Android编译期间设置Build。*参数,甚至将其部署在硬件本身上。

您可以通过读取/ proc / *“文件”来访问Linux实时硬件信息。

你可以这样做[https://stackoverflow.com/a/3528239/997381]

只需按命令输入adb shell

您可以使用adb shell对此进行测试,并且不需要root权限。

cadavre answered 2020-08-01T11:26:46Z
1 votes

android.os中的“ Build”类看起来将包含您需要的一些信息

用作

string build = Build.VERSION.DEVICE;

android硬件信息

ry8806 answered 2020-08-01T11:27:15Z
translate from https://stackoverflow.com:/questions/10496872/android-get-hardware-information-programmatically