Search code examples
androidaccelerometer

How to Refresh WebPage using accelerometer values


I have created application with accelerometer values. i want to refresh the webpage using the accelerometer Values (X,Y,Z).

Notes: I having one webpage named index.html in that while clicking on the button i can reload the page.. using window.location.reload()

but i want to reload index.html page using accelerometer values. i had a application getting accelerometer values..

how can i identify pro-grammatically, the device is shaken..


Solution

  • Look at the full example on the Accleration doc page. In the onSuccess method of watchAcceleration you can update your web page. I would not tell it to reload as that would stop all the JS running on the page and cause PhoneGap, etc. to get reloaded.