Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GWT Accelerometer: report availability only if sensor is present #5758

Merged

Conversation

MrStahlfelge
Copy link
Member

GWT Accelerometer is reported as present if the web browser supports it even if there is no accelerometer. This is not correct, using Chrome on Desktop reports an available accelerometer.

This commit changes getPeriphalAvailable in a way that accelerometer availability is only returned if real sensor data is present, this matches the behaviour of the other platforms.

Note: At first I wanted to use the onError callback of the sensor, but it was called on my mobile device too. I was not able to find out why, because the callback provides no error message.

Sorry for the diff. GwtInput had CRLF line endings which I was not able to commit. I think this is okay because (most) libGDX sources have LF line endings in general.

@MrStahlfelge MrStahlfelge changed the title GWT Accelerometer: report availability only if sensor data is available GWT Accelerometer: report availability only if sensor is present Aug 14, 2019
Copy link
Contributor

@intrigus intrigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split the reformatting and the actual change into different commits.

@MobiDevelop MobiDevelop merged commit 6ac58f6 into libgdx:master Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants