c***@163.com
c***@163.com
  • 发布:2024-12-12 17:17
  • 更新:2024-12-12 17:17
  • 阅读:302

纯血鸿蒙不支持plus,请问申请权限应该如何改造一下?

分类:uni-app

我现在是这样写的:
// 检查是否开启麦克风权限
const checkRecordPermission = () => {
// #ifdef APP-PLUS
const recordPermission = plus.navigator.checkPermission('RECORD')
if (recordPermission != 'authorized') {
showModal('权限提醒', '为了您能够完整体验语音转文字功能,系统将会获取您的麦克风权限,是否前往开启【麦克风】权限?').then((res) => {
if (res.confirm) {
showLoading('跳转中...', true)
// 弹出提示框解释为何需要读写手机储存权限,引导用户打开设置页面开启
var main = plus.android.runtimeMainActivity();
var Intent = plus.android.importClass("android.content.Intent");
//直接进入应用列表的权限设置
var mIntent = new Intent('android.settings.APPLICATION_SETTINGS');
main.startActivity(mIntent);
hideLoading()
} else if (res.cancel) {
uni.showToast({
title: '未开启麦克风权限',
icon: 'none',
duration: 2200
});
return false;
}
})
} else {
return true;
}
// #endif
}
我看到社区里面说用uts开发,但是没找到应该具体怎么写,我应该怎么申请对应权限呢

2024-12-12 17:17 负责人:无 分享
已邀请:

要回复问题请先登录注册