检索设备信息在Android设备、信息、Android

2023-09-05 02:31:13 作者:〆、﹎生離ヤ

我的计划是瞄准了Android 1.5。我想检索有关设备自身的系统信息。我发现很少有帮助的课程通过搜索的API。最好的,我发现到目前为止是运行类和几个生成。* 系统属性。

My program is targeting Android 1.5. I would like to retrieve system information about the device itself. I have found very few helpful classes by searching the APIs. the best I've found so far is the Runtime class and a few Build.* system properties.

我希望能够得到这样的存储设备上的总金额,可用内存量(这是我不知道的信息,如果运行类是实际上可以给我,因为它专指可用内存JVM)以及有关处理器的信息。

I would like to be able to get information like the total amount of memory on the device, the amount of free memory (which I do not know if the Runtime class is acutally giving me, since it specifically refers to memory available to the JVM) along with information about the processor.

时提供这些信息,如果是这样,我在哪里可以找到它?

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

推荐答案

的内存总量为pretty的意义(例如G1的物理RAM,其中90-100MB之间已经可以到192MB内核和不同版本的应用程序,但不包括内存用于窗口的缓冲区和其他各种东西,每一个Java应用程序有16MB其堆的限制,所以可用的RAM系统更加有多少进程则可以在同一时间运行)。

"Total amount of memory" is pretty meaningless (for example G1 has 192MB of physical RAM, of which between 90-100MB has been available to the kernel and apps across different releases, but that doesn't include memory used for window buffers and various other things, and each Java application has a limit of 16MB for its heap, so the available RAM to the system is more about how many processes can be running at the same time).

可用内存量实在是没什么意义。我们一般尽量让尽可能多的应用程序仍然正常运行,因为可用内存,使正常的和Linux缓存通常有很少没有免费的内存。如果你看一下原始的空闲内存在内核中,你会看到不同的pretty的疯狂随着时间推移,应用程序启动和使用一些内存,推下来,那么其他应用程序获得擦去使其跳方式备份直到缓存和其他的东西有机会吞噬它备份。

"Amount of free memory" is really really meaningless. We generally try to let as many applications remain running as there is available memory, so between that and normal Linux caches there generally is little no free memory. If you do look at the raw free memory in the kernel, you will see that varying pretty crazily over time as applications start up and use some memory, pushing it down, then other applications get expunged causing it to jump way back up until caches and other things have a chance to gobble it back up.

我想到了在这一点看系统的内存状态的最好方法是,是在2.0中引入的正在运行的服务的用户界面。是的,在底部的内存信息是可怕的微妙和毫无意义的多数人;我们应该尝试找出如何改进它。 :)

The best way I have come up at this point to look at the memory state of the system is the "Running services" UI that was introduced in 2.0. Yes, the memory information at the bottom is horribly subtle and meaningless to most people; we should try to figure out how to improve it. :)

您可以找出CPU架构通过android.os.Build.CPU_ABI NDK code。这给你的CPU架构的基准,但信息,如CPU是否支持NEON指令或此类。对于这方面的信息,您可以想见,使用NDK的运行一些本地code来询问CPU。

You can find out the CPU architecture for NDK code via android.os.Build.CPU_ABI. This gives you a baseline for the CPU architecture, but information like whether the CPU supports NEON instructions or such. For that kind of information, you could conceivably use the NDK to run some native code to interrogate the CPU.