Android Question Detect device orientation in background service

daemon

Active Member
Licensed User
Longtime User
How can I detect device orientation in a background service that is configured to start at boot (i.e. none of my activities have run)?

I also need to get events when the orientation changes, so that I can start using new orientation.

Update: I tried using PhoneOrientation, but since my device does not have orientation sensor, I never received OrientationChanged event.
 
Last edited:

daemon

Active Member
Licensed User
Longtime User
I want to know exact rotation (0, 90, 180, 270) of device, even when it is in locked state.
Display orientation does not seem to change in locked state.
 
Upvote 0
Top