Use this API to lock the screen to a specific orientation. This is useful for video players, games, or other content that requires a specific orientation.
Parameters
Property
Type
Required
Description
orientation
String
Yes
Indicates the orientation of the screen, portrait or landscape.
success
Function
No
Callback on success
fail
Function
No
Callback on failure. Receives error (Number, error code) and errorMessage (String)
complete
Function
No
Callback that always executes
Success Callback Parameters
Property
Type
Description
success
Boolean
Specifies whether the call is successful. When the value is true, the call is successful.
Code Example
Basic Usage
my.setScreenOrientation({ orientation: 'landscape', success() { console.log('Orientation set to landscape'); }});