cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joaquim Rego (JIRA)" <>
Subject [jira] [Commented] (CB-9082) Accelerometer not working on moto G 2
Date Thu, 26 May 2016 14:14:13 GMT


Joaquim Rego commented on CB-9082:

I've found the exact same issue.

The problem happens when the device doesn't report accuracy changes - while in CB-9339, the
default accuracy was set to medium, thus apparently solving the problem, when we stop watching
acceleration, the accuracy is set to unreliable... the next time you start it again, it will
already be set to unreliable and it won't report any acceleration.

private void stop() {
        if (this.status != AccelListener.STOPPED) {
        this.accuracy = SensorManager.SENSOR_STATUS_UNRELIABLE;

I think this can be fixed either by:

# *Don't reset acceleration on stop*: This would change the behavior when the device reports
accuracy, because upon restart, app will use the same accuracy as the last onAccuracyChanged,
and that may be inconsistent with real accuracy (until a new onAccuracyChanged is triggered).
I don't know if this can actually happen, given that in my experience, when the device reports
accuracy, it will do it immediately after registering the acceleration listener - of course
that's not documented, and unsafer to assume...

# *Always set acceleration to medium before starting*: Similar drawbacks as the 1st solution
- when reporting, we may be setting a value higher than the current value and it will only
be fixed when the 1st onAccuracyChange is triggered. So, it won't change the stop behavior,
but we would end up with 2 lines for a behavior similar to option 1;

# *Reset acceleration on stop only if onAccuracyChanged was triggered*: the most reliable
option, given that it keeps the same behavior when device triggers accuracy changes - have
a flag for when onAccuracyChanged is triggered and reset or don't reset accordingly (if it
doesn't trigger accuracy, don't reset; if it does reset).

> Accelerometer not working on moto G 2
> -------------------------------------
>                 Key: CB-9082
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Device Motion
>         Environment: Android
>            Reporter: thiago ramires kairala
> Accelerometer doesn't work on moto g 2 but works on any other device

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message