views:

328

answers:

1

I've been looking at using a WebView to display an HTML5 webpage, where the novel features of the mobile device (GPS, compass, accelerometer, camera, etc) can be fed back into the web page.

I was wondering if there were any good tutorials showing these functions interacting with the webview.

So far I've found ways for the WebView to send javascript commands to the web page, but those interactions haven't been triggered from outside the web view (such as upon receiving an intent from the GPS or accelerometer).

Note: The HTML5 Geolocation API is not what I'm interested in. I'm interested in the web page <-> WebView interactions, as noted here: http://android-developers.blogspot.com/2008/09/using-webviews.html

+1  A: 

Here is a sample project showing feeding a location into a WebView's Javascript.

CommonsWare
thanks for the pointer Mark. If I wanted to get accelerometer/compass updates, would I be able to set up a BroadcastReceiver for these Intents, and push that data down to the WebView's javascript?
Adam
Accelerometer and compass updates are handled via listeners, like the location stuff. There are no broadcast `Intents` for accelerometer and compass updates.
CommonsWare