Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically find Android system info

Tags:

java

android

I am trying to programatically find the system info for Android devices, specifically:

  • RAM
  • CPU speed
  • # cores, architecture, etc.

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.

like image 775
Chris Ridmann Avatar asked Apr 18 '12 23:04

Chris Ridmann


People also ask

How do I find my android device info?

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.

How do I find device information?

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.

How can I get Android OS programmatically?

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.


2 Answers

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.

like image 188
Shankar Agarwal Avatar answered Oct 13 '22 11:10

Shankar Agarwal


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

like image 44
slayton Avatar answered Oct 13 '22 12:10

slayton