Reputation: 453
During some period that an android service is running the screen rotation needs to be disabled. Is there any way to disable/enable the screen rotation from an android service?
Upvotes: 0
Views: 69
Reputation: 6345
You can imagine that what may happen if service controls the mode of device - there may be an app's activity who requested or need a landscape mode because user has rotated the device but the service (which is running in background) which user has no idea, is forcing the portrait mode for the device, even though user rotated device for landscape experience - not good for overall user experience.
Hence, AFAIK, the android:screenOrientation
option which controls the landscape/portrait mode, is applicable to Activity
class only & not to the Service
.
Since Service's
job is to run in background it typically does not contain any UI & hence options such as how the UI elements are to be display i.e in landscape or portrait mode is not the role of Service
.
Upvotes: 1