2016-09-28 136 views
-2

我想要得到的RAMROMCPUBatteryInternal Storage我的移動設備的編程。我已經得到構建標識設備名稱指紋我的設備的。我經歷了很多問題,但沒有找到解決方案。任何有關這方面的幫助將不勝感激。安卓:獲取手機硬件信息

我想這樣的觀點,這些信息 enter image description here

+0

檢出設備控制。它的開源幷包含這些信息。 https://play.google.com/store/apps/details?id=org.namelessrom.devicecontrol https://github.com/Evisceration/DeviceControl – GoneUp

回答

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); 
0

我是用這個在我的代碼,所以我把所有:

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);