当前位置:网站首页>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); }); }
边栏推荐
- NK - RTU980 burning bare-metal program
- Read Elephant Swap in one article, why does it bring such a high premium to ePLATO?
- Vscode: Project-tree plugin
- NK-RTU980烧写裸机程序
- 【MySQL功法】第5话 · SQL单表查询
- 云服务器部署 Web 项目
- 【小程序项目开发 -- 京东商城】uni-app 商品分类页面(下)
- [Cloud native] Introduction and use of Feign of microservices
- 基于golang的swagger超贴心、超详细使用指南【有很多坑】
- Cloud server deployment web project
猜你喜欢
Doraemon teach you forwarded and redirect page

How to upgrade nodejs version

如何在一台机器上(windows)安装两个MYSQL数据库

如何升级nodejs版本

How on one machine (Windows) to install two MYSQL database
![[MySQL exercises] Chapter 2 Basic operations of databases and data tables](/img/43/73a59a293d4708b6f9aeae990a7029.png)
[MySQL exercises] Chapter 2 Basic operations of databases and data tables

关于Error EPERM operation not permitted, mkdir...几种解决办法的比较

google搜索技巧——程序员推荐

【MySQL中auto_increment有什么作用?】

安装部署KubeSphere管理kubernetes
随机推荐
如何在一台机器上(windows)安装两个MYSQL数据库
sqlmap使用教程大全命令大全(图文)
mysql插入新字段方法
0730~Mysql优化
【小程序专栏】总结uniapp开发小程序的开发规范
0730~Mysql optimization
TypeError The view function did not return a valid response. The function either returned None 的解决
【C#】说说 C# 9 新特性的实际运用
Vue项目通过node连接MySQL数据库并实现增删改查操作
关于“算力”,这篇文章值得一看
Locust 1.0版本引入的变化
ZCMU--1862: zbj的狼人杀
Pygame Surface对象
UML图及在drawio中的绘制
【MySQL功法】第4话 · 和kiko一起探索MySQL中的运算符
Open Source | Commodity Recognition Recommender System
Ceph single node deployment
ScheduledExecutorService - 定时周期执行任务
mysql insert new field method
Spark 在 Yarn 上运行 Spark 应用程序
