Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
manateeworks-barcodescanner-fork
Advanced tools
Readme
Version 1.9.1
Guide on how to add the Manatee Works Barcode Scanner Phonegap plugin to your project(s)
For more in-depth info, visit our website at www.manateeworks.com
##Install using CLI interface (Phonegap 3.0 and above)
To have already installed Phonegap
sudo npm install -g phonegap
To have created the app by using CLI interface and added desired platforms
phonegap create my-mw-app
cd my-mw-app
phonegap run android
(if you are developing for android)
Add plugin to the project with:
phonegap plugin add manateeworks-barcodescanner
or
phonegap local plugin add https://github.com/manateeworks/phonegap-mwbarcodescanner.git
or
phonegap local plugin add LOCAL_PATH_TO_THE_FOLDER_WITH_PLUGIN (if you are adding from local folder)
or install using plugman: (your platform should be already built)
plugman install --platform ios|android --project platforms/ios|platforms/android --plugin com.manateeworks.barcodescanner --plugins_dir plugins/ --www www/
Perform initial build for each platform (repeat the command twice if not working after first time, seems there's a bug in phonegap 3.3)
phonegap local build ios
phonegap local build android
phonegap local build wp8
Add a button to index.html which will call the scanner:
<form style="width: 100%; text-align: center;">
<input type="button" value="Scan Barcode" onclick="scanner.startScanning()" style="font-size: 40px; width: 300px; height: 50px; margin-top: 100px;"/>
</form>
###How to build online with bulid.phonegap.com:
Copy confing.xml from project’s dir to /www
Add this line in www/confing.xml:
<gap:plugin name="manateeworks-barcodescanner" source="npm"/>
Add this code in www/index.html:
<form style="width: 100%; text-align: center;">
<input type="button" value="Scan Barcode" onclick="scanner.startScanning()" style="font-size: 40px; width: 300px; height: 50px; margin-top: 100px;"/>
</form>
##How to scan an image
Instead of scanner.startScanning() use:
scanner.scanImage(URI);
or with custom init and callback:
scanImage(MWBSInitSpace.init,MWBSInitSpace.callback,URI);
Params:
URI - the path to the image
MWBSInitSpace.init - scanner initialisation
MWBSInitSpace.callback - result callback
##How to scan in partial screen view
Instead of scanner.startScanning() use:
scanner.startScanning(x, y, width, height);
or with custom init and callback:
startScanning(MWBSInitSpace.init, MWBSInitSpace.callback, x, y, width, height);
Params:
x, y, width, height - rectangle of the view in percentages relative to the screen size
MWBSInitSpace.init - scanner initialisation
MWBSInitSpace.callback - result callback
Example:
<form style="width: 100%; text-align: center;">
<input type="button" value="Scan fullscreen" onclick="scanner.startScanning()" style="font-size: 12px; width: 105px; height: 30px; margin-top: 10px;"/>
<input type="button" value="Scan in view" onclick="scanner.startScanning(0,4,100,50)" style="font-size: 12px; width: 105px; height: 30px; margin-top: 10px;"/>
<input type="button" value="Pause/Resume" onclick="scanner.togglePauseResume()" style="font-size: 12px; width: 105px; height: 30px; margin-top: 10px;"/>
<input type="button" value="Close" onclick="scanner.closeScanner()" style="font-size: 12px; width: 105px; height: 30px; margin-top: 10px;"/>
<input type="button" value="Flash" onclick="scanner.toggleFlash()" style="font-size: 12px; width: 105px; height: 30px; margin-top: 10px;"/>
<input type="button" value="Zoom" onclick="scanner.toggleZoom()" style="font-size: 12px; width: 105px; height: 30px; margin-top: 10px;"/>
</form>
<ul id="mwb_list">
</ul>
</br>
##Important change in 1.9
New feature: Parsers. Users can now parse the scanned result.
mwbs['MWBsetActiveParser'](constants.MWP_PARSER_MASK_ISBT);
Available options:
MWP_PARSER_MASK_NONE
MWP_PARSER_MASK_AUTO
MWP_PARSER_MASK_GS1
MWP_PARSER_MASK_IUID
MWP_PARSER_MASK_ISBT
MWP_PARSER_MASK_AAMVA
MWP_PARSER_MASK_HIBC
##Important change in 1.8.8
Support for android app permissions requires using Cordova-Android 5.0.0+. In order to use our plugin on Cordova-Android <5.0.0 consider downgrading to 1.8.7
##Important change in 1.5
This library is now thread safe and multithreading is enabled. Users have the option to set the maximum number of threads (CPUs) the scanner can use by adding this line in the decoder initialization:
mwbs['MWBsetMaxThreads'](NUM_OF_MAX_THREADS)
###Important change in 1.4
Users now can put decoder initialization and callback in separate Javascript file, so that they don't lose their changes when they update the plugin. Sample file is js/MWBConfig.js.
To use the custom script, user need to include it in the index file like so:
<script type="text/javascript" src="js/MWBConfig.js"></script>
and start the scanner with:
scanner.startScanning(MWBSInitSpace.init,MWBSInitSpace.callback);
All init and callback function can still be declared inside MWBScanner.js file, but will be overwritten on plugin update.
WP8 Note
It's seems there's a bug in Phonegap 3.0 so you have to add html '<script type="text/javascript" src="cordova.js"></script>'
in index.html (or other html files) manually
##Manual Install (Phonegap 2.x or 3.0)
###Android:
Create a Phonegap Android app;
Copy the folder 'src/android/com/manateeworks' to your project's 'src/com/' folder;
Copy the file 'src/android/res/layout/scanner.xml' to your project's 'res/layout' folder;
Copy the file 'src/android/res/drawable/overlay_mw.png' to your project's 'res/drawable' folder. Do the same for the file in 'drawable-hdpi' folder;
Copy the files 'src/android/libs/armeabi/libBarcodeScannerLib.so' and 'Android/libs/armeabi-v7a/libBarcodeScannerLib.so' to your project's 'libs/' folder, all the while preserving the same folder structure
Copy the file 'www/MSBScanner.js' to the 'assets/www/js' folder;
Insert the Scanner activity definition into AndroidManifest.xml:
<activity android:name="com.manateeworks.ScannerActivity"
android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity>
<script type="text/javascript" src="js/MWBScanner.js"></script>
<form style="width: 100%; text-align: center;">
<input type="button" value="Scan Barcode" onclick="startScanning()" style="font-size: 20px; width: 300px; height: 30px; margin-top: 50px;"/>
</form>
For Phonegap 2.x
<plugins>
...
<plugin name="MWBarcodeScanner" value="com.manateeworks.BarcodeScannerPlugin"/>
...
</plugins>
For Phonegap 3 *
<feature name="MWBarcodeScanner">
<param name="android-package" value="com.manateeworks.BarcodeScannerPlugin" />
</feature>
Import .R file of your project (import YOUR_APP_PACKAGE_NAME.R;) to the 'src/com/manateeworks/ScannerActivity.java';
Upon license purchase, replace the username/key pairs for the corresponding barcode types in the file 'src/com/manateeworks/BarcodeScannerPlugin.java';
Run the app and test the scanner by pressing the previously added button;
(Optional): You can also replace our default overlay_mw.png for the camera screen with your own customized image;
(For Phonegap 3) If notification plugin is not present in project, add it by following instructions from this url:
http://docs.phonegap.com/en/3.0.0/cordova_notification_notification.md.html
<uses-permission android:name="android.permission.CAMERA" />
(For Phonegap 2.x) In BarcodeScannerPlugin.java replace org.apache.cordova reference to org.apache.cordova.api :
Instead:
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
Use this:
import org.apache.cordova.api.CallbackContext;
import org.apache.cordova.api.CordovaPlugin;
###iOS:
Create a Phonegap iOS app;
Copy all files from our 'src/ios' folder to your project's 'Plugins' folder and add them to the project;
Copy the file 'www/MSBScanner.js' to the folder 'www/js' . NOTE: You cannot drag & drop directly into the Xcode project... use Finder instead;
Insert MWBScanner.js script into index.html:
<script type="text/javascript" src="js/MWBScanner.js"></script>
<form style="width: 100%; text-align: center;">
<input type="button" value="Scan Barcode" onclick="startScanning()" style="font-size: 20px; width: 300px; height: 30px; margin-top: 50px;"/>
</form>
For Phonegap 2.x
<plugins>
...
<plugin name="MWBarcodeScanner" value="CDVMWBarcodeScanner"/>
...
</plugins>
For Phonegap 3
<feature name="MWBarcodeScanner">
<param name="ios-package" value="CDVMWBarcodeScanner" />
</feature>
Confirm you have the following frameworks added to your project: CoreVideo, CoreGraphics;
Upon license purchase, replace the username/key pairs for the corresponding barcode types in the file Plugins/MWBarcodeScanner/MWScannerViewController.m;
Run the app and test the scanner by pressing the previously added button;
(Optional): You can replace our default overlay_mw.png and close_button.png for the camera screen with your own customized image;
###Windows Phone 8:
Add (drag & drop) MWBarcodeScanner folder into the project folder named 'plugins'. If needed, create Plugins folder in project previously;
Copy (this time from Windows Explorer, not by way of drag & drop) to the project BarcodeLib.winmd and BarcodeLib.dll to project root;
Add (drag & drop) www/MWBScanner.js to www/js/ project folder;
Insert MWBScanner.js script into index.html:
<script type="text/javascript" src="js/MWBScanner.js"></script>
<form style="width: 100%; text-align: center;">
<input type="button" value="Scan Barcode" onclick="scanner.startScanning()" style="font-size: 40px; width: 300px;height: 50px; margin-top: 100px;"/>
</form>
Add BarcodeLib.winmd to project references: right click on 'References', 'Add Reference', 'Browse' and choose the file;
Add the plugin to config.xml:
For Phonegap 2.x
<plugins>
...
<plugin name="MWBarcodeScanner" value="MWBarcodeScanner"/>
...
</plugins>
For Phonegap 3
<feature name="MWBarcodeScanner">
<param name="wp-package" value="MWBarcodeScanner" />
</feature>
Add a notification plugin (if not already present):
<plugin name="Notification" value="Notification"/>
(For Phonegap 2.9) Sometimes a bug occurs in Phonegap 2.9.0 with notification dialogs, making them crash on closing. It may be necessary to make a change in the Plugins/Notification.cs file:
inside function: void btnOK_Click
replace the following block:
NotifBoxData notifBoxData = notifBoxParent.Tag as NotifBoxData;
notifyBox = notifBoxData.previous as NotificationBox;
callbackId = notifBoxData.callbackId as string;
if (notifyBox == null)
{
page.BackKeyPress -= page_BackKeyPress;
}
with the one below:
NotifBoxData notifBoxData = notifBoxParent.Tag as NotifBoxData;
if (notifBoxData != null)
{
notifyBox = notifBoxData.previous as NotificationBox;
callbackId = notifBoxData.callbackId as string;
if (notifyBox == null)
{
page.BackKeyPress -= page_BackKeyPress;
}
}
Add ID_CAP_ISV_CAMERA capability into WMAppManifest.xml
Upon license purchase, replace the username/key pairs for the corresponding barcode types in file Plugins/com.manateeworks.barcodescanner/BarcodeHelper.cs;
Run the app and test the scanner by pressing the previously added button;
(Optional): You can replace our default overlay_mw.png for the camera screen with your own customized image;
###Changes in 1.9:
###Changes in 1.8.8:
###Changes in 1.8.6:
Added option for using the front facing camera:
mwbs['MWBuseFrontCamera'](true);
Bug fixes
###Changes in 1.8.2:
Added option to set scanning rectangle for partial view scanning. To use it just add the following line to the scanner configuration:
mwbs['MWBuseAutoRect'](false);
Bug fixes
###Changes in 1.8:
Added new feature that makes possible scanning in view:
scanner.startScanning(x, y, width, height);
//all parameters represent percentages relative to the screen size
Other methods for partial screen scanning control:
scanner.togglePauseResume() - toggle pause resume scanning
scanner.closeScanner() - stop and remove scanner view
scanner.toggleFlash() - toggle flash on/off
scanner.toggleZoom() - toggle zoom in/out
###Changes in 1.7.1:
###Changes in 1.7:
Added scanImage(URI) which can be used for image scanning. Optionally, the method can be used with custom init and callback - scanImage(MWBSInitSpace.init,MWBSInitSpace.callback,URI);
URI - the path to the image
MWBSInitSpace.init - scanner initialisation
MWBSInitSpace.callback - result callback
###Changes in 1.6:
Added continuous scanning functionality:
mwbs['MWBcloseScannerOnDecode'](false) - to enable continuous scanning
scanner.resumeScanning() - for resuming after successful scan
scanner.closeScanner() - to finish with continuous scanning
Added support for 64bit android devices.
Camera overlay bug fixes.
###Changes in 1.5:
Added support for multithreading. The user can set the maximum number of threads by adding this line in the decoder initialization:
mwbs['MWBsetMaxThreads'](NUM_OF_MAX_THREADS)
Added MWBsetMinLength: function - allows user to set the minimum length of the code for weak protected code types (like: Code 25, MSI, Code 39, Codabar, Code 11...) to avoid false detection of short barcode fragments. This method can be used by adding this line in the decoder intialization:
mwbs['MWBsetMinLength'](constants.MWB_CODE_MASK, MIN_LENGTH);
Plugin is now plugman compatible
Added IATA Code 25 support
Improved detection of Databar Expanded barcode type
###Changes in 1.4:
Added support for custom init and callback functions. All init and callback function can still be declared here, but users can now use an outside Javascript file that they can maintain during updates, so that they don't lose their changes when they update. To use the custom script, they only need to include it in the index file like so:
<script type="text/javascript" src="js/MWBConfig.js"></script>
To call the scanner with the custom init and callback you use
scanner.startScanning(MWBSInitSpace.init,MWBSInitSpace.callback);
Added MWBsetCustomParam: function - allows user to put some custom key/value pair which can be used later from native code
Added ITF-14 support
Added Code 11 support
Added MSI Plessey support
Added GS1 support
###Changes in 1.3:
Zoom feature added for iOS and Android. It's not supported on WP8 due to API limitation.
Added function to turn Flash ON by default
Fixed 'frameworks was not added to the references' on WP8
Fixed freezing if missing org.apache.cordova.device plugin
Added x86 lib for Android
CameraManager.java rework
It now contains complete camera handling functionality, other files from camera folder are not necessary
###Changes in 1.2:
You can now enter your licensing info without changing the native code of plugin;
Import package_name.R manually after adding Android plugin is not necessary anymore
Decoding library updated to 2.9.31
###Changes in 1.1:
You can now choose between Simple Image Overlay and MW Dynamic Overlay, which shows the actual viewfinder, depending on selected barcode types and their respective scanning rectangles;
Now there's only a single function for supplying orientation parameters which makes tweaking the controller for changing scanner orientation no longer needed;
Added option to choose between high or normal resolution scanning to better match user application requirements;
Added option to enable or disable the flash toggle button;
FAQs
Manatee Works Barcode Scanner Plugin
The npm package manateeworks-barcodescanner-fork receives a total of 2 weekly downloads. As such, manateeworks-barcodescanner-fork popularity was classified as not popular.
We found that manateeworks-barcodescanner-fork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.