Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
capacitor-plugin-barcodescanner
Advanced tools
Capacitor Plugin to add barcode scanner capabilities
Capacitor Plugin to add barcode scanner capabilities to your capacitor app.
Note it only supports the android platform at the moment.
Install the plugin package by calling
npm install capacitor-plugin-barcodescanner
then call
npx cap update
to update the android platfrom.
Open the android project and the MainActivity.java
to register the plugin
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initializes the Bridge
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
add(BarcodeScanner.class);
}});
// some other code
}
In your web app, to consume the plugin you have to register for a barcode scanner notifications:
import { Plugins, Capacitor } from '@capacitor/core';
import {
BarcodeScannerPlugin,
EVENT_BARCODE_SCANNED,
IBarcodeScannerEventPayload,
} from 'capacitor-plugin-barcodescanner';
// can be used later to remove BarcodeScanner listener
let removeScannerHandler?: (() => void) = undefined;
const barcodeScanned = (state: IBarcodeScannerEventPayload): void => {
console.log("BarcodeScanned - ",state.cancelled, state.barcode, state.error)
}
// Get the BarcodeScanner plugin
const BarcodeScanner = Plugins.BarcodeScanner as BarcodeScannerPlugin;
// Register listener
removeScannerHandler = BarcodeScanner.addListener(
EVENT_BARCODE_SCANNED,
barcodeScanned
).remove;
// call to start scanning....
BarcodeScanner.scan();
// this will call the plugin's scan method which starts scanning activity, after finishing the `EVENT_BARCODE_SCANNED` will be issued.
// when not needed
if(removeScannerHandler) {
removeScannerHandler();
removeScannerHandler = undefined;
}
FAQs
Capacitor Plugin to add barcode scanner capabilities
The npm package capacitor-plugin-barcodescanner receives a total of 1 weekly downloads. As such, capacitor-plugin-barcodescanner popularity was classified as not popular.
We found that capacitor-plugin-barcodescanner 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.