未验证 提交 a59f081c 编写于 作者: O openharmony_ci 提交者: Gitee

!14469 monthly:授权示例更新

Merge pull request !14469 from fanchenxuan/monthly_20221018
......@@ -161,12 +161,13 @@
### FA模型下的示例代码
```js
//ability的onWindowStageCreate生命周期
onWindowStageCreate() {
var context = this.context
import featureAbility from '@ohos.ability.featureAbility';
reqPermissions() {
let context = featureAbility.getContext();
let array:Array<string> = ["ohos.permission.PERMISSION2"];
//requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
context.requestPermissionsFromUser(array).then(function(data) {
context.requestPermissionsFromUser(array, 1).then(function(data) {
console.log("data type:" + typeof(data));
console.log("data:" + data);
console.log("data permissions:" + data.permissions);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册