setScreenOrientation

The setScreenOrientation function is used to configure the initial screen orientation of a mini program when it is first launched.

Method signature

copy
setScreenOrientation(@NonNull screenOrientation: GRVStartupParams.ScreenOrientation): GRVStartupParams.Builder

Parameters

Parameter

Data Type

Default value

Required

Description

screenOrientation

GRVStartupParams.ScreenOrientation

GRVStartupParams.ScreenOrientation.PORTRAIT

Yes

This parameter is used to configure the initial screen orientation of a mini program when it is first launched.

Valid values:

  • PORTRAIT: indicates the orientation is portrait .
  • LANDSCAPE: indicates the orientation is landscape .
  • AUTO: indicates the orientation is the same as that of the mobile device.

If this parameter is not specified, the inital screen orientation is PORTRAITby default.

Sample

copy
val startupParams = GRVStartupParams.createBuilderForApp(context, appId)
    .setScreenOrientation(GRVStartupParams.ScreenOrientation.LANDSCAPE)
    .build()
Griver.openApp(startupParams,null)

User experience

Value

Screenshot

PORTRAIT

image.png

LANDSCAPE

image.png