To get permission to access device features or data outside of your Tuanjie application’s sandbox, there are two stages:
For some permissions, Tuanjie automatically handles both the build-time OpenHarmony App module entries and runtime permission requests. For more information, see Tuanjie-handled permissions.
An OpenHarmony application can only request the user for permission to use device features or data that it declares in its OpenHarmony App module. This is the build-time stage of OpenHarmony permission handling. For information on how to declare permissions, see Declare permissions for an application.
You can request runtime permissions at any time while the application is running. It’s best practice to request permission for restricted data or a device feature when the application requires the data/feature for the first time. You should also show the user a message that explains why the application requires the data/feature before you send the request. This is important to give users context so they are less likely to deny the permission out of confusion.
For information on how to request permission at runtime, see Request runtime permissions.
Important: If you try to request the user for a permission that the OpenHarmony App module doesn’t declare, the device doesn’t show the permission dialogue.
Depending on the Player Settings and Tuanjie APIs that the application uses, Tuanjie automatically adds some required permissions to the OpenHarmony App module and sends permission requests at runtime. This also applies to any plug-ins that the application uses.
The following list explains which permissions Tuanjie handles automatically:
INTERNET
permission to the OpenHarmony App module.LOCATION
permission to the OpenHarmony App module and requests permission from the user the first time that the application uses location.CAMERA
permission to the OpenHarmony App module and requests permission from the user the first time that the application uses WebCamTexture
.RECORD_AUDIO
permission to the OpenHarmony App module and requests permission from the user the first time that the application uses Microphone
.