From 380a56a0b5236bf867bd11d10ceaa185351ea892 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Wed, 7 Sep 2016 10:09:38 -0400 Subject: [PATCH] Issue #270: OS 10 requires Camera permission reason --- README.md | 21 ++++++++++++++++----- plugin.xml | 4 +++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e926b415..496c460a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Follows the [Cordova Plugin spec](https://cordova.apache.org/docs/en/latest/plug ## Installation - + This requires phonegap 5.0+ ( current stable v3.0.0 ) phonegap plugin add phonegap-plugin-barcodescanner @@ -42,11 +42,22 @@ Note: Windows 10 applications can not be build for `AnyCPU` architecture, which cordova run windows -- --archs=x86 ``` +Note: Since iOS 10 it's mandatory to add a `NSCameraUsageDescription` in the info.plist. + +`NSCameraUsageDescription` describes the reason that the app accesses the user’s camera. +When the system prompts the user to allow access, this string is displayed as part of the dialog box. + +To add this entry you can pass the following variable on plugin install. + +``` +cordova plugin add phonegap-plugin-barcodescanner --variable CAMERA_USAGE_DESCRIPTION="To scan barcodes" +``` + ### PhoneGap Build If you're using [PhoneGap Build](https://build.phonegap.com/) please make sure you specify `gradle` as your Android build tool in `config.xml`: ``. ## Using the plugin ## -The plugin creates the object `cordova/plugin/BarcodeScanner` with the method `scan(success, fail)`. +The plugin creates the object `cordova/plugin/BarcodeScanner` with the method `scan(success, fail)`. The following barcode types are currently supported: ### Android @@ -138,7 +149,7 @@ A full example could be: "Result: " + result.text + "\n" + "Format: " + result.format + "\n" + "Cancelled: " + result.cancelled); - }, + }, function (error) { alert("Scanning failed: " + error); }, @@ -154,7 +165,7 @@ A full example could be: ## Encoding a Barcode ## -The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`. +The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`. Supported encoding types: @@ -186,7 +197,7 @@ Cancelling a scan on BlackBerry 10 is done by touching the screen. ## Thanks on Github ## -So many -- check out the original [iOS](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/iOS/BarcodeScanner), [Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/BarcodeScanner) and +So many -- check out the original [iOS](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/iOS/BarcodeScanner), [Android](https://github.com/phonegap/phonegap-plugins/tree/DEPRECATED/Android/BarcodeScanner) and [BlackBerry 10](https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/BarcodeScanner) repos. ## Licence ## diff --git a/plugin.xml b/plugin.xml index 53d6cc7c..d1d99abd 100644 --- a/plugin.xml +++ b/plugin.xml @@ -11,6 +11,8 @@ https://github.com/phonegap/phonegap-plugin-barcodescanner https://github.com/phonegap/phonegap-plugin-barcodescanner/issues + + @@ -30,7 +32,7 @@ - + $CAMERA_USAGE_DESCRIPTION