Proximity Sensor

From WebOS Internals
Revision as of 01:13, 28 April 2010 by Donrhummy (talk | contribs)
Jump to navigation Jump to search

While poking around in com.palm.app.crotest code I found some code that interacts with the IR proximity sensor. I think quite a few apps could use it as an input, for one the stock "Clock" app can utilize it to control it's alarm / snooze / dismiss functions. I haven't done much with it yet and don't think it would be appropriate to cut-paste code here but if you're interested in exploring this functionality check out:

/usr/palm/applications/com.palm.app.crotest/app/controllers/proximity-assistant.js

I'll try and update this page when I find more information / code examples.

UPDATE: The code in "proximity-assistant.js" does not get any events from the proximity sensor. It is unable to know whether a user has gotten close to the proximity sensor. All it can do is turn the sensor on (and be notified that it successfully set it on). The screen turning off is done by the sensor, NOT by the phone app's code. Unfortunately, this means the proximity sensor is useless for apps like the alarm clock suggested above.