Closed stefanocudini closed 8 years ago
Hi stefanocudini,
Thank you for your wonderful contribution to the society. So what should I do just to change from self._rotateCompass(e.webkitCompassHeading); to self._rotateCompass(-e.alpha); in order to use the compass on android?
I think this is the way, but unfortunately I do not have Android devices for testing. Maybe @sabas can help you
I'm testing it. Hope it works, I will post my test later!!
ok please patch and fork.. I need of this contribute!
wow, it works smoothly. just have to to change from self._rotateCompass(e.webkitCompassHeading); to self._rotateCompass(-e.alpha); and then it works great. Thanks for your contribution
Here is demo : http://jsfiddle.net/thienbao92/e9avga6m/1/
@mstn maybe you are interested
Tested on Ionic/phonegap hybrid app builder on android, windows phone and iOS. Everything works great.
Perhaps could be integrated in the plugin? (if it's not working in ios it could be added some platform sniffing code)
thanks @thienbao92 please can you send me a pull request including android support?
you can use the new Leaflet API L.Browser property for discern the behavior: http://leafletjs.com/reference.html#browser
android browser work fine but new chrome no, it shows strange values on event deviceorientationabsolute or deviceorientation
support Android Chrome device from version 1.0.0
FYI @jpuerto @sabas @tombtom
Thanks for the update!
Check compatibility on: https://github.com/stefanocudini/leaflet-compass/blob/master/src/leaflet-compass.js#L94
iOS: self._rotateCompass(e.webkitCompassHeading);
HTML5! self._rotateCompass(-e.alpha);
Reference: http://www.w3.org/TR/orientation-event/