Obtaining Cutout Screen Information
On Android devices, obtain information such as notch height, punch hole height, and cutout area of the cutout screen for adapting to cutout screens.Ensure application content display is not obscured.
Common application scenarios:
- UI layout adaptation: Obtain the safe area of the screen and adjust the positions of HUDs, buttons, and other interface elements to prevent them from being obscured.
- Project content adaptation: In project scenarios, adjust camera position, Role position, etc. based on cutout screen data to ensure scene objects are not obscured.
- Portrait-landscape switching: Refresh cutout screen data when the screen rotates to ensure that layouts in different orientations correctly avoid the cutout area.
note
This interface applies only to Android devices and is called asynchronously.
Client API
Callback Interface
Callback interfaces for the Player Network SDK tool module, see:
- Unity
- Unreal Engine
| API | Function Definition |
|---|---|
| AddCutoutInfoObserver | Register the callback for the Player Network SDK asynchronous notch information retrieval interface CutoutInfoResult.Handles the callback for the LoadCutoutData interface. |
| RemoveCutoutInfoObserver | Unregister the callback for CutoutInfoResult. |
| API | Function Definition |
|---|---|
| SetCutoutInfoObserver | Set the callback for the Player Network SDK asynchronous notch information retrieval interface CutoutInfoResult. |
| GetCutoutInfoObserver | Retrieve the callback for CutoutInfoResult. |
| OnCutoutResult_Implementation | Implements the callback for CutoutInfoResult of the LoadCutoutData interface. |
Tools API
For tool interfaces of Player Network SDK, see:
- Unity
- Unreal Engine
| API | Function Definition |
|---|---|
| LoadCutoutData | When the screen rotates, it is necessary to reacquire the cutout screen information after rotation. |
| API | Function Definition |
|---|---|
| LoadCutoutData | When the screen rotates, it is necessary to reacquire the cutout screen information after rotation. |