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

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

Open
ZuZuK opened this issue Oct 18, 2015 · 3 comments
Open

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

ZuZuK opened this issue Oct 18, 2015 · 3 comments

Comments

@ZuZuK
Copy link

ZuZuK commented Oct 18, 2015

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

@nvanbenschoten
Copy link
Owner

Hi ZuZuK, thanks for bringing this issue to attention! For now, it doesn't look like there has been any confirmation that SENSOR_DELAY_GAME is the fastest supported rate on Android M, only that there are specific instances where it doesn't work. Because of this, I'd hate to hardcode something like the workaround into the library prematurely.

That being said, my plan for now is to:

  • Expose sensorDelay as an optional parameter to registerSensorManager, as discussed in Using SENSOR_DELAY_UI #11. This will at least allow the workaround you specified to be pushed out of the library for now.
  • Monitor the issue you linked to for future updates.

@nvanbenschoten
Copy link
Owner

I have release version v1.1.2, which should expose an option to configure the sensor delay as a temporary workaround.

@ZuZuK
Copy link
Author

ZuZuK commented Nov 7, 2015

thx) working fot me

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

No branches or pull requests

2 participants