当前位置:网站首页>MUI获取相机权限
MUI获取相机权限
2022-07-31 08:05:00 【樱花花】
mui获取相机权限
- 安卓
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
- IOS
- 获取摄像头权限
function requestPermission() { plus.android.requestPermissions( ["android.permission.CAMERA"], function(resultObj) { for (var i = 0; i < resultObj.granted.length; i++) { var grantedPermission = resultObj.granted[i]; console.log('已获取的权限:' + grantedPermission); } for (var i = 0; i < resultObj.deniedPresent.length; i++) { var deniedPresentPermission = resultObj.deniedPresent[i]; console.log('拒绝本次申请的权限:' + deniedPresentPermission); } for (var i = 0; i < resultObj.deniedAlways.length; i++) { var deniedAlwaysPermission = resultObj.deniedAlways[i]; console.log('永久拒绝申请的权限:' + deniedAlwaysPermission); } // 若所需权限被永久拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限 if (resultObj.deniedAlways.length > 0) { var Intent = plus.android.importClass("android.content.Intent"); var Settings = plus.android.importClass("android.provider.Settings"); var Uri = plus.android.importClass("android.net.Uri"); var mainActivity = plus.android.runtimeMainActivity(); var intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); var uri = Uri.fromParts("package", mainActivity.getPackageName(), null); intent.setData(uri); mainActivity.startActivity(intent); } }, function(error) { console.log('申请权限错误:' + error.code + " = " + error.message); }); }
边栏推荐
- Collation and sharing of related classic papers and datasets in the field of deep learning communication
- MySQL安装常见报错处理大全
- 【小程序项目开发-- 京东商城】uni-app之商品列表页面 (上)
- UML图及在drawio中的绘制
- [Cloud native and 5G] Microservices support 5G core network
- 如何在一台机器上(windows)安装两个MYSQL数据库
- 循环结构--for循环
- MySQL 5.7 安装教程(全步骤、保姆级教程)
- "C language" frog jumping steps recursion problem
- 云服务器部署 Web 项目
猜你喜欢
随机推荐
云服务器部署 Web 项目
科目三:右转弯
一文读懂Elephant Swap,为何为ePLATO带来如此高的溢价?
《C语言小游戏》扫雷
torch分布式训练
【MySQL功法】第2话 · 数据库与数据表的基本操作
免安装版的Mysql安装与配置——详细教程
【Unity】编辑器扩展-04-拓展Scene视图
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
48页智慧城市规划蓝图 解决方案
分布式缓存系统必须要解决的四大问题
力扣 593. 有效的正方形
Linux redis6.2.6 configuration file
mysql insert new field method
Golang-based swagger super intimate and super detailed usage guide [there are many pits]
uniapp 高度不自适应
SSM框架简单介绍
【小程序项目开发-- 京东商城】uni-app之自定义搜索组件(下) -- 搜索历史
SSM整合案例分析(详解)
[Mini Program Project Development--Jingdong Mall] Custom Search Component of uni-app (Middle)--Search Suggestions