Skip to content

Commit

Permalink
Make compatible with [email protected] and android @7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestmid committed Aug 2, 2018
1 parent 3fa83a1 commit dd22b85
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,6 @@ Installation
cordova plugin add cordova-gmv-barcode-scanner
````

### Android

If you are using this plugin for the Android platform, it is **very important** that you place the following code inside the `config.xml` file in the root of your Cordova project. This is a preference that will be utilized by the [`cordova-custom-config`](https://github.com/dpa99c/cordova-custom-config) library, which is included as a dependency of the plugin, so that the theming is provided to Android. If you do not do this then the plugin will crash the application when initializing a scan..

````xml
<preference name="android-manifest/application/@android:theme" value="@style/Theme.AppCompat" />
````

If using cordova-android@7 or above use
````xml
<custom-preference name="android-manifest/application/@android:theme" value="@style/Theme.AppCompat" />
````

Usage
-----

Expand Down Expand Up @@ -128,12 +115,14 @@ var options = {

The `detectorSize` option does not currently exclude the area around the detector from being scanned, which means that anything shown on the preview screen is up for grabs to the barcode detector. On iOS this is done automatically.

The flashlight/torch on Android does not currently work. I do not have an Android device to develop with, and the flashlight doesn't work in emulators, so I have yet to solve the issue. Please submit a PR if you have the solution to the issue.

### VIN Scanning

VIN scanning works on both iOS and Android and utilizes both Code39 and Data Matrix formats. The scanner has a VIN checksum validator that ensures that the 9th VIN digit is correctly calculated. If it is not, the barcode will simply be skipped and the scanner will continue until it finds a valid VIN.

### Driver's License Scanning

Driver's license scanning works on both iOS and Android and scans the PDF417 format and decodes according to the AAMVA specification. It only pulls a few fields, but I believe they are the most important. The decoding is done in the Javascript portion of this plugin which means you could modify it if you'd like.

### Commercial Use
This VIN scanner is the primary reason I built out this project, and is used in a commercial application for my company. Additionally, PDF417 scanning on drivers licenses is a massive benefit to the speed of the GMV library. I'd ask that any competitors don't utilize the VIN scanner for vehicles or PDF417 scanner for drivers licenses in applications that offer similar service to the [dealr.cloud](http://dealr.cloud) application.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-gmv-barcode-scanner",
"version": "1.2.1",
"version": "1.2.2",
"description": "Google Mobile Vision Barcode Scanner Plugin",
"cordova": {
"id": "cordova-gmv-barcode-scanner",
Expand Down
28 changes: 22 additions & 6 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
<source-file src="src/ios/CameraViewController.m"/>
</platform>
<platform name="android">
<config-file parent="/*" target="app/src/main/res/xml/config.xml">
<config-file parent="/*" target="res/xml/config.xml">
<feature name="cordova-gmv-barcode-scanner">
<param name="android-package" value="com.dealrinc.gmvScanner.CDVAndroidScanner"/>
</feature>
</config-file>
<config-file parent="/*" target="app/src/main/res/xml/config.xml">
<preference name="android-manifest/application/@android:theme" value="@style/Theme.AppCompat" />
</config-file>

<config-file parent="/*" target="app/src/main/AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" />
Expand All @@ -56,7 +53,27 @@
<activity android:label="Read Barcode" android:name="com.dealrinc.gmvScanner.BarcodeCaptureActivity" android:theme="@style/Theme.AppCompat.Light"/>
</config-file>

<config-file target="app/src/main/res/values/strings.xml" parent="/*">
<config-file parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.CAMERA" />
</config-file>
<config-file parent="application" target="AndroidManifest.xml">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode" />

<activity android:label="@string/title_activity_main" android:name="com.dealrinc.gmvScanner.SecondaryActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="Read Barcode" android:name="com.dealrinc.gmvScanner.BarcodeCaptureActivity" android:theme="@style/Theme.AppCompat.Light"/>
</config-file>

<config-file target="res/values/strings.xml" parent="/*">
<string name="ok">OK</string>
<string name="permission_camera_rationale">Access to the camera is needed for detection</string>
<string name="no_camera_permission">This application cannot run because it does not have the camera permission. The application will now exit.</string>
Expand Down Expand Up @@ -112,5 +129,4 @@

<framework src="src/android/build-extras.gradle" custom="true" type="gradleReference"/>
</platform>
<dependency id="cordova-custom-config" url="https://github.com/dpa99c/cordova-custom-config.git" />
</plugin>

0 comments on commit dd22b85

Please sign in to comment.