Marine-Compass | A 3-dimensional floating compass for the web
kandi X-RAY | Marine-Compass Summary
kandi X-RAY | Marine-Compass Summary
A 3-dimensional floating compass for the web
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Marine-Compass
Marine-Compass Key Features
Marine-Compass Examples and Code Snippets
Community Discussions
Trending Discussions on Marine-Compass
QUESTION
I'm trying to create a reliable compass in Javascript/JQuery (using deviceorientation) so that it works on iOS and Android mobile devices. I know nearly every (very old) question/answer here in Stackoverflow about this topic. I have created a pretty simple compass that is working fine on iOS devices. On Android devices (Galaxy S8) I have a weird behaviour: Like every day I'm testing it the compass direction North switches by an offset to -45/+45, 90 (North is in East), 180 (North is in South) or 270 degrees (North is in West). Yes, I considered compass calibration (8-figure movement, turning the mobile around it's 3 axes before testing).
Here's the Javascript code for the compass:
...ANSWER
Answered 2020-Mar-19 at 17:15The problem is that your alpha is not absolute, means 0 is not north instead 0 is where the device is pointing on activation.
The best way to fix for chrome-based browsers, like most standard Android Browsers ist using an AbsoluteOrientationSensor from W3C Generic Sensor API polyfills. Github
The Project I used it in is Typescript based. So here is a Typescript example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Marine-Compass
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page