Flipping screen orientation bug? [Android]

I an currently working on a game that utilizes the accelerometer with the device in the flat plane, but on my Samsung Galaxy S5, when I tilt the phone in any direction around 45* the phone orientation flips, and it gets all messed up. I was wondering if there is a fix for this? If not, could we get a screen orientation lock?

Doesn’t Android have an orientation lock built into the OS?

It does, I tried that, it does not change the behavior.

Can you link me to a test level? There’s a setting I can change to lock it to 1 landscape mode instead of flipping between the two when the device rotates.

This is where I experience the bug.

I was wondering if this is going to go any further. I still experience this bug, and would love to have this fixed, or an option.

It is happening to my friend in natural disaster survival!

Your friend’s might be a different bug as this topic was made 5 years ago