Comments (1)
While adding the ability to restrict the allowed barcode formats (cuts down on read errors), aside from passing that option thru to zxing, I made these changes in my copy:
Within BarcodeScanner.java
import android.content.ComponentName; // added
private static final String SCAN_INTENT = "com.google.zxing.client.android.SCAN"; // changed
private static final String SCAN_CLASS = "com.google.zxing.client.android.CaptureActivity"; // added
private static final String ENCODE_INTENT = "com.google.zxing.client.android.ENCODE"; // changed
...
Intent intentScan = new Intent(SCAN_INTENT); // same
intentScan.setComponent(new ComponentName(this.cordova.getActivity().getApplicationContext(),SCAN_CLASS));
intentScan.addCategory(Intent.CATEGORY_DEFAULT); // same
in plugin.xml:
action android:name="com.google.zxing.client.android.SCAN"
and
action android:name="com.google.zxing.client.android.ENCODE"
and I restored the action checking code that Eccenux commented out in EncodeActivity.java
The zxing library is looking for the actions "com.google.zxing.client.android.SCAN" and "com.google.zxing.client.android.ENCODE" rather than "com.phonegap.plugins.barcodescanner.SCAN" and "ENCODE". Giving the specific component in the Intent prevents going to other apps that use the same library.
I'm new to plugins and Android. Expect that this can be done better or just plain done right. Please speak up if you see problems with this approach. After some field testing, I'll try to share the restricted format code too.
from barcodescanner.
Related Issues (20)
- Frame the camera view? HOT 1
- App crash HOT 1
- Interface is too ugly, can you change HOT 3
- QR code scanning is very slow on iOS
- PDF417 ios
- Scanning only first barcode part
- success-function returns nothing
- android,The image is distorted in the scan area HOT 1
- build fail
- .
- How to change UIColors
- CAMERA_USAGE_DESCRIPTION not added to Info.plist
- NSCameraUsageDescription... localized strings
- Trying to add a back button in android. HOT 1
- Disable flashlight at volume-buttons
- After the last update I get a "Access violation"-Error when starting the Scanner on W10/W10(m)
- Modifying cordova bar code scanner plugin interface in sap ui5 for andriod
- What is the minimum version of Android to use this plugin?
- German text encoding issue while scanning qr code HOT 1
- Archive repo and move ownership to the phonegap one HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from barcodescanner.