// Divide by 90 into an int to round, then multiply out to one of 5 positions, either 0,90,180,270,360.
int orientation = 90*Math.round(mDeviceOrientation / 90);
// Convert 360 to 0
if(orientation == 360)
orientation = 0;
wish helps you Found the solution. The problem is caused by some newer devices' default orientation is set landscape while the others' portrait. So the sensor manager behaves accordingly. In order to get sensor manager work as you expect you need to detect the defaultDisplayRotation of the device and change the remapCoordinateSystem() parameter logic.