From 7783913b0860c3cd19124bb0f31bd608eb009ddd Mon Sep 17 00:00:00 2001 From: lloyd <353627866@qq.com> Date: Thu, 11 Sep 2025 15:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=AE=9E=E7=8E=B0=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8A=9F=E8=83=BD=E3=80=91=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/pages/Index.ets | 8 +++++++- hvigor/hvigor-config.json5 | 2 +- oh-package.json5 | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 8df08aa..fb6f780 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -218,7 +218,13 @@ struct Index { // Obtain current location switch status and pull up the global switch to set the pop-up box. isLocationToggle(): void { let atManager = abilityAccessCtrl.createAtManager(); - let isLocationEnabled = geoLocationManager.isLocationEnabled(); + let isLocationEnabled = true; + try { + isLocationEnabled = geoLocationManager.isLocationEnabled(); + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'Index', `isLocationEnabled failed, error code=${err.code}, message=${err.message}`); + } if (!isLocationEnabled) { atManager.requestGlobalSwitch(this.context, abilityAccessCtrl.SwitchType.LOCATION).then((data: boolean) => { if (data) { diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index 06b2783..5bebc97 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/oh-package.json5 b/oh-package.json5 index bb12751..2d9c74f 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,10 +1,8 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "description": "Please describe the basic information.", "dependencies": { }, "devDependencies": { - "@ohos/hypium": "1.0.19", - "@ohos/hamock": "1.0.0" } } -- Gitee