Scripting Kid
Scripting Kid

Reputation: 11

How to use javascript to get proximity or ambient light sensor value from mobile device?

I'm looking for a way to get proximity or ambient light sensor value through javascript for web app development. I know that it's possible on each platform through every native app development.

Upvotes: 1

Views: 2836

Answers (3)

Anmol Jain
Anmol Jain

Reputation: 411

Currently only Firefox supports proximity sensor API. https://developer.mozilla.org/en-US/docs/Web/API/DeviceProximityEvent

Upvotes: 0

michaelpoltorak
michaelpoltorak

Reputation: 464

You can access a device's proximity sensor through the DeviceProximityEvent event. Unfortunately, at the moment only Firefox for desktop and Firefox for Android support the proximity API: https://developer.mozilla.org/en-US/docs/Web/API/DeviceProximityEvent

Upvotes: 1

Something like PhoneGap might be a good bet. Their API: http://docs.phonegap.com/ .

Upvotes: 0

Related Questions