javascript - Is it possible to access a mobile devices battery status or charge via a web browser api? -


i've spend time looking around see if possible access mobile devices battery status or charge via web browser api haven't found resources or discussing topic. makes me believe it's not possible isn't in spec of whatever reason (security?).

either way i've found possible battery status / charge percentage ios, cordova, phonegap, appcelerator etc.. of has api might able work might work looking developing. of these solutions still required app run native app — i'm hoping able run in browser on device.

is possible? if so, browser api should looking into?

thanks tapani , michael,

your pointed me in right direction. info provided able find more info on spec , browsers support api.

  • chrome 42.0.2311.90 (64-bit) not seem support battery api.
  • chromium version 22.0.1225.0 (149762) not support battery api.
  • chrome canary version 44.0.2387.0 canary (64-bit) supports spec on mdn (https://developer.mozilla.org/en-us/docs/web/api/battery_status_api) not support navigator.battery namespace.
  • firefox supports navigator.battery namespace not support navigator.getbattery() function.
  • safari version 8.0.5 (10600.5.17) doesn't support referring battery api can tell.

i didn't around checking on mobile don't suspect mobile browsers more consistent api or have implemented better of above browsers. seems new , browsers organizations still trying figure out , struggling follow documented spec. reminds me bit of css flex-box bit.

thanks guys!


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -