I’ve run into a problem that appears to affect only dual-core Android devices running Android 2.3 (Gingerbread
or greater). I’d like to give a dialog regarding this issue, but only to my users that fit that criterion. I know how to check OS level but haven’t found anything that can definitively tell me the device is using multi-core.
Any ideas?
Unfortunately for most Android devices, the availableProcessors() method doesn’t work correctly. Even /proc/stat doesn’t always show the correct number of CPUs.
The only reliable method I’ve found to determine the number of CPUs is to enumerate the list of virtual CPUs at /sys/devices/system/cpu/ as described in this forum post. The code:
This Java code should work in any Android application, even without root.