我希望以编程方式获取移动设备的RAM
,ROM
,CPU
,Battery
,Internal Storage
。我已经获得 Build我的设备的ID ,设备名称,指纹。我经历了很多问题,但没有找到解决方案。对此有任何帮助将不胜感激。
答案 0 :(得分:1)
我在我的代码上使用它,所以我把所有:
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);
答案 1 :(得分:0)
此代码段将提供您需要的大部分信息
//Ram information
ActivityManager actManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
MemoryInfo memInfo = new ActivityManager.MemoryInfo();
actManager.getMemoryInfo(memInfo);
long totalMemory = memInfo.totalMem;
//Internal Space
long freeBytesInternal = new File(ctx.getFilesDir().getAbsoluteFile().toString()).getFreeSpace();
//External Available space
long freeBytesExternal = new File(getExternalFilesDir(null).toString()).getFreeSpace();
//This will out put whole lot of information about cpu just extract what you want
String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
ProcessBuilder pb = new ProcessBuilder(args);
Process process = pb.start();
InputStream in = process.getInputStream();
//Battery information
BatteryManager bm = (BatteryManager)getSystemService(BATTERY_SERVICE);
int batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);