检索设备信息在Android

编程入门 行业动态 更新时间:2024-10-11 07:32:56
本文介绍了检索设备信息在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的计划是瞄准了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.

更多推荐

检索设备信息在Android

本文发布于:2023-11-06 08:31:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563200.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设备   信息   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!