diff --git a/harmony-os/SherpaOnnxVadAsr/entry/src/main/ets/pages/Index.ets b/harmony-os/SherpaOnnxVadAsr/entry/src/main/ets/pages/Index.ets index 5aef4d9a8..b0695f3a0 100644 --- a/harmony-os/SherpaOnnxVadAsr/entry/src/main/ets/pages/Index.ets +++ b/harmony-os/SherpaOnnxVadAsr/entry/src/main/ets/pages/Index.ets @@ -46,8 +46,14 @@ struct Index { const permissions: Permissions[] = ["ohos.permission.MICROPHONE"]; let allowed: boolean = await allAllowed(permissions); if (!allowed) { - requestPermissions(permissions); console.log("request to access the microphone"); + const status: boolean = await requestPermissions(permissions); + + if (!status) { + console.error('access to microphone is denied') + this.resultForMic = "Failed to get microphone permission. Please retry"; + return; + } allowed = await allAllowed(permissions); if (!allowed) {