From e30f7165e9f974302d83f39a09ec3c9d9c2685ee Mon Sep 17 00:00:00 2001 From: wangxinbo Date: Thu, 15 May 2025 19:38:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:LocationKit=20FAQ=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/pages/ApplyPrecisePositioning.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets b/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets index 4b91243..a6c241b 100644 --- a/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets +++ b/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets @@ -17,7 +17,7 @@ * FAQ:如何申请精确定位 */ -// DocsCode 1 +// [Start apply_precise_positioning] import { abilityAccessCtrl, common, PermissionRequestResult, Permissions } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; @@ -54,4 +54,4 @@ export struct ApplyPrecisePositioning { build() { } } -// DocsCode 1 \ No newline at end of file +// [End apply_precise_positioning] \ No newline at end of file -- Gitee From 09d53cc392389c333e7940bf1e55f23a693f01f8 Mon Sep 17 00:00:00 2001 From: kejintao Date: Sat, 17 May 2025 06:52:30 +0000 Subject: [PATCH 2/2] =?UTF-8?q?locationkit1=E4=BF=AE=E6=94=B9=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=B8=BA=E8=8B=B1=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kejintao --- .../src/main/ets/pages/ApplyPrecisePositioning.ets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets b/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets index a6c241b..b24e454 100644 --- a/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets +++ b/LocationKit/entry/src/main/ets/pages/ApplyPrecisePositioning.ets @@ -32,20 +32,20 @@ export struct ApplyPrecisePositioning { reqPermissionsFromUser(permissions: Array): void { let context: Context = getContext(this) as common.UIAbilityContext; let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); - // requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 + // RequestPermissionsFromUser will determine whether to trigger a pop-up window based on the authorization status of the permission atManager.requestPermissionsFromUser(context, permissions).then((data: PermissionRequestResult) => { let grantStatus: Array = data.authResults; let length: number = grantStatus.length; for (let i = 0; i < length; i++) { if (grantStatus[i] === 0) { - // 用户授权,可以继续访问目标操作 + // User authorization allows continued access to the target operation } else { - // 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限 - this.getUIContext().getPromptAction().showToast({ message: '用户拒绝授权' }); + // The user refuses authorization, prompting the user that authorization is required to access the functionality of the current page, and guiding the user to open the corresponding permissions in the system settings + this.getUIContext().getPromptAction().showToast({ message: 'User refuses authorization' }); return; } } - // 授权成功 + // Authorization successful }).catch((err: BusinessError) => { console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`); }) -- Gitee