简体   繁体   中英

How to get Device Information Using HTML5 Javascript & Phonegap

I'm developing a cross-platform mobile application using HTML5 Javascript & Phonegap. It's supposed to be an application which can display the Device Information and RAM & CPU status (using & free RAM CPU, name, size,...). But I can find any API which can get the status of CPU&RAM. I'm just a beginner in Mobile HTML5&JavaScript. So, if you guys know anything that can help, please tell me. I'll be very appriciated. Thank you!

In a plain web app you don't have access to this information. But since you mentioned Phonegap in your question, you can get basic device info using this:

http://docs.phonegap.com/en/3.0.0/cordova_device_device.model.md.html#device.model

There are also 2 cordova plugins which you can look into. Neither has iOS support at the time of this writing.

http://plugins.cordova.io/#/package/com.ankamagames.plugins.sysinfo http://plugins.cordova.io/#/package/org.chromium.system.memory

You may want to look at Chrome packaged apps and the chrome.* apis for cross platform and mobile development here https://developer.chrome.com/apps/about_apps

Although I never worked on such area. But what I can suggest is- You will need to write android native plugin to achieve the same.

I think there should be android api to read memoryinfo and cpuinfo file if not you can directly read /proc/cpuinfo and /proc/memoryinfo to get ram and cpu related information. Hope it will give you some insight. Below is the link of related question - Android How do you get total memory RAM in the device?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM