0
votes

I have an app that reads QR codes. It's built on iOS and Android. On iOS works fine. My problems are in 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

If I look into the AndroidManifest file, I can read this:

 <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

thanks!

1

1 Answers

1
votes

I have the same problem here. It's related to the new Android 6 (API 23) permissions. Setting the targetSdkVersion to "22" solves the problem for now, but this should be fixed.

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