Skip to content

Android M Parallax problems on Nexus 5 (at least) #19

Description

@gavriilsitnikov

have no parallax effect on Nexus 5 + Android M (6.0) because there is a bug when someone is trying to register to sensor manager with SENSOR_DELAY_FASTEST rate.

so my workaround at this moment is:

public void registerSensorManager() {
        if (getContext() == null || mSensorManager != null) return;
        mSensorManager = (SensorManager) getContext().getSystemService(Context.SENSOR_SERVICE);

        if (mSensorManager != null) {
            int sensorUpdateRate = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
                    ? SensorManager.SENSOR_DELAY_GAME
                    : SensorManager.SENSOR_DELAY_FASTEST;
            mSensorManager.registerListener(this,
                    mSensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR),
                    sensorUpdateRate);
        }
    }

P.S. guess this bug appeared in Android M because of battery optimizations so maybe they are deprecated this rate or so. can't find details. bug is described here: https://code.google.com/p/android/issues/detail?id=189681&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions