Retrieving Android Device Information

My program is for Android 1.5. I would like to get system information about the device itself. I found very few useful classes by looking at the API. the best I've found so far is the Runtime class and a few Build.* system properties.

I would like to receive information, such as the total amount of memory on the device, the amount of free memory (which I do not know if the Runtime class gives me the opportunity, since it specifically refers to the memory available to the JVM) along with information about the processor.

Is this information available, and if so, where can I find it?

+4
source share
1 answer

"Total memory" is pretty pointless (for example, G1 has 192 MB of physical memory, of which between 90-100 MB is available to the kernel and applications of different versions, but this does not include the memory used for the buffer window and other things, and every Java application has a limit of 16 MB for its heap, so the available RAM for the system depends more on how many processes can work simultaneously).

The "amount of free memory" is really really pointless. As a rule, we try to keep so many applications running as there is available memory, so there is generally little free memory between these and regular Linux caches. If you look at the raw free memory in the kernel, you will see that over time, when applications start up and use some kind of memory, they repel, and then other applications fail, which leads them to jump back. while caches and other things have a chance to gobble it up.

The best way that I came at this point to look at the state of the system’s memory is with the "Running services" interface, which was introduced in 2.0. Yes, the memory information below is very subtle and meaningless for most people; we should try to figure out how to improve it. :)

You can find out the CPU architecture for the NDK code using android.os.Build.CPU_ABI. This gives you a basic foundation for the CPU architecture, but information, for example, on whether the processor supports NEON instructions or something similar. For such information, you could use the NDK to run your own code to query the CPU.

+3
source

Source: https://habr.com/ru/post/1300311/


All Articles