提交 2891a2d2 编写于 作者: T tianwenzhe

change api

Signed-off-by: Ntian-wenzhe411 <tianwenzhe2@huawei.com>
上级 2eca517c
import Ability from '@ohos.app.ability.UIAbility'
const PERMISSIONS: Array<string> = [
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA',
'ohos.permission.CAPTURE_SCREEN']
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
this.context.requestPermissionsFromUser(PERMISSIONS)
globalThis.dir=this.context.filesDir;
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
......@@ -18,8 +13,11 @@ export default class MainAbility extends Ability {
}
onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
let AtManager = abilityAccessCtrl.createAtManager();
AtManager.requestPermissionsFromUser(this.context,["ohos.permission.READ_MEDIA","ohos.permission.WRITE_MEDIA",
"ohos.permission.CAPTURE_SCREEN"]).then(() => {})
windowStage.loadContent("pages/index", (err, data) => {
if (err.code) {
......
......@@ -122,7 +122,7 @@ struct CustomContainer1 {
await fileio.close(fd);
Logger.info(TAG, `write done`);
prompt.showToast({
message: '图片保存成功', duration: 1000
message: '结果保存成功', duration: 1000
});
}
getScreen = (isFullScreen: boolean) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册