I am trying to programatically find the system info for Android devices, specifically:
Are there any Android classes that specify this information. I have been using the android.board library, but it doesn't seem to have everything that I want.
Go into the Settings menu of your device and check for an option that details the Android system info. This can vary depending on your brand of device and whether it's a phone or a tablet. As you can see from this screenshot, all we can really glean from this information screen is the model name and Android version.
This example demonstrate about How to get device info in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. In the above code, we have taken text view to show device version number.
Let me tell you what I did, So others who visit this thread can come to know the steps:
1) parse /proc/meminfo command. You can find reference code here: Get Memory Usage in Android 2) use below code and get current RAM:
MemoryInfo mi = new MemoryInfo();
ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
activityManager.getMemoryInfo(mi);
long availableMegs = mi.availMem / 1048576L;
Note: please note that - we need to calculate total memory only once. so call point 1 only once in your code and then after, you can call code of point 2 repetitively.
You can get most of the information you want from the /proc/cpuinfo
file. Here is a tutorial on how to load and parse that file: http://www.roman10.net/how-to-get-cpu-information-on-android/
Additionally the information about the RAM can be obtained from the /proc/meminfo
file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With