```
let context = getContext(this) as common.UIAbilityContext;
let atManager = abilityAccessCtrl.createAtManager();
let permissions: Array<string> = ['ohos.permission.READ\_MEDIA','ohos.permission.WRITE\_MEDIA']
atManager.requestPermissionsFromUser(context, permissions)
.then((data) => {
console.log("Succeed to request permission from user with data: " + JSON.stringify(data))
}).catch((error) => {
console.log("Failed to request permission from user with error: " + JSON.stringify(error))
})
```