提交 ceed9fc5 编写于 作者: F fanchenxuan

Beta5:授权示例更新

Signed-off-by: Nfanchenxuan <fanchenxuan@huawei.com>
上级 4f3902ea
......@@ -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.
先完成此消息的编辑!
想要评论请 注册