Programmatically find information about the Android system


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.

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