简体   繁体   English

IONIC ANDROID-条形码扫描仪应用程序不要求相机许可

[英]IONIC ANDROID - Barcode scanner app doesn't ask for camera permissions

I have an app that reads QR codes. 我有一个读取QR码的应用。 It's built on iOS and Android. 它基于iOS和Android。 On iOS works fine. 在iOS上运行正常。 My problems are in Android. 我的问题是在Android中。 When I tap the "scan" button nothing happens. 当我点击“扫描”按钮时,没有任何反应。

If I add camera permissions from: Settings > My App > Camera, the app works but on every clean installation the app doesn't ask for camera permissions and barcode fails again. 如果我从以下位置添加相机权限:设置>我的应用程序>相机,则该应用程序可以运行,但是在每次全新安装时,该应用程序都不会要求相机权限,并且条形码再次失败。

This is my ionic info: 这是我的离子信息:

 Cordova CLI: 6.1.1
 Gulp version:  CLI version 3.8.11
 Gulp local:   Local version 3.9.1
 Ionic Version: 1.2.4
 Ionic CLI Version: 1.7.14
 Ionic App Lib Version: 0.7.0
 ios-deploy version: Not installed
 ios-sim version: 3.1.1
 OS: Mac OS X El Capitan
 Node Version: v5.5.0

Xcode version: Xcode 7.3 Build version 7D175 Xcode版本:Xcode 7.3 Build版本7D175

If I look into the AndroidManifest file, I can read this: 如果查看AndroidManifest文件,则可以阅读以下内容:

 <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
 <uses-permission android:name="android.permission.CAMERA" />
 <uses-permission android:name="android.permission.FLASHLIGHT" />
 <uses-feature android:name="android.hardware.camera" android:required="false" />

I don't know how can I do to fix that problem... 我不知道该如何解决该问题...

This is the plugin that I'm using: https://github.com/phonegap/phonegap-plugin-barcodescanner 这是我正在使用的插件: https : //github.com/phonegap/phonegap-plugin-barcodescanner

thanks! 谢谢!

I have the same problem here. 我在这里有同样的问题。 It's related to the new Android 6 (API 23) permissions. 这与新的Android 6(API 23)权限有关。 Setting the targetSdkVersion to "22" solves the problem for now, but this should be fixed. 将targetSdkVersion设置为“ 22”可以解决此问题,但这应该是固定的。

This is the exception in logcat: W/ServiceManager: Permission failure: android.permission.CAMERA from uid=10293 pid=1417 E/CameraService: Permission Denial: can't use the camera pid=1417, uid=10293 com.ionicframework.fm176018 W/CameraBase: An error occurred while connecting to camera: 0 com.ionicframework.fm176018 W/CaptureActivity: Unexpected error initializing camera java.lang.RuntimeException: Fail to connect to camera service 这是logcat中的例外:W / ServiceManager:权限失败:来自uid = 10293 pid = 1417的android.permission.CAMERA E / CameraService:权限被拒绝:无法使用相机pid = 1417,uid = 10293 com.ionicframework。 fm176018 W / CameraBase:连接到摄像头时发生错误:0 com.ionicframework.fm176018 W / CaptureActivity:初始化摄像头java.lang.RuntimeException的意外错误:无法连接到摄像头服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM