Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  15] [ 2]  / answers: 1 / hits: 37201  / 14 Years ago, fri, december 17, 2010, 12:00:00

Is there any way to access accelerometer data using Javascript on Android's browser? I know it supports onorientationchange, but I'd like to get everything.



Clarification: I'm asking how to do this in a website, not a native app.


More From » android

 Answers
50

As of ICS, Android 4.0, you can use the 'devicemotion' event via a JavaScript event listener to access the accelerometer data. See the W3C documentation on how to access it - http://dev.w3.org/geo/api/spec-source-orientation.html.



Note - The W3C documentation title is named with 'device orientation', but the spec does indeed include 'devicemotion' event documentation.


[#94563] Wednesday, December 15, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kamronr

Total Points: 749
Total Questions: 110
Total Answers: 122

Location: Dominica
Member since Sat, Nov 5, 2022
2 Years ago
kamronr questions
Mon, Dec 21, 20, 00:00, 3 Years ago
Fri, Oct 16, 20, 00:00, 4 Years ago
Sat, Oct 3, 20, 00:00, 4 Years ago
Sun, Jul 28, 19, 00:00, 5 Years ago
;