Skip to main content
←API Reference ←com.nianticspatial.nsdk ←Orientation

fromSurfaceRotation


Declaration​

fun fromSurfaceRotation(rotation: Int): Orientation

Summary​

Converts an Android display rotation into the corresponding device Orientation.


Pass the value returned by Display.rotation — one of Surface.ROTATION_0,
Surface.ROTATION_90, Surface.ROTATION_180, or Surface.ROTATION_270.
Any unrecognized value maps to UNKNOWN.


This produces the device/UI orientation expected by
FrameData.screenOrientation and by the orientationProvider of
createLiveDataSource. It is the inverse-free, sensor-agnostic mapping;
renderers that need the flipped landscape convention should additionally
apply their own rendering transform rather than swapping here.

Returns​

The matching Orientation, or UNKNOWN if unrecognized.

Parameters​

NameTypeSummary
rotationInt
A Surface.ROTATION_* value (typically Display.rotation).