
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
nativescript-barcodescanner
Advanced tools
Scan a barcode (or a QR code, or a lot of other formats really)
From the command prompt go to your app's root folder and execute:
tns plugin add nativescript-barcodescanner
formats
)formats
) var barcodescanner = require("nativescript-barcodescanner");
barcodescanner.scan({
formats: "QR_CODE,PDF_417", // Pass in of you want to restrict scanning to certain types
cancelLabel: "Stop scanning", // iOS only, default 'Close'
message: "Go scan something", // Android only, default is 'Place a barcode inside the viewfinder rectangle to scan it.'
preferFrontCamera: false, // Android only, default false
showFlipCameraButton: true, // Android only, default false (on iOS it's always available)
orientation: "landscape" // Android only, optionally lock the orientation to either "portrait" or "landscape"
}).then(
function(result) {
console.log("Scan format: " + result.format);
console.log("Scan text: " + result.text);
},
function(error) {
console.log("No scan: " + error);
}
)
Note that the Android implementation will always return true
at the moment.
var barcodescanner = require("nativescript-barcodescanner");
barcodescanner.available().then(
function(avail) {
console.log("Available? " + avail);
}
);
On Android 6 you need to request permission to use the camera at runtime when targeting API level 23+.
Even if the uses-permission
tag for the Camera is present in AndroidManifest.xml
.
Note that hasCameraPermission
will return true when:
barcodescanner.hasCameraPermission().then(
function(granted) {
// if this is 'false' you probably want to call 'requestCameraPermission' now
console.log("Has Camera Permission? " + result);
}
);
// if no permission was granted previously this wil open a user consent screen
barcodescanner.requestCameraPermission().then(
function() {
console.log("Camera permission requested");
}
);
Note that the scan
function will also check for permission and ask for it if it wasn't previously granted.
If you're relying on that, then you should know that since we're not catching the consent result
the user will then need to allow camera access and launch the scanner again.
FAQs
Scan QR/barcodes with your NativeScript app.
The npm package nativescript-barcodescanner receives a total of 58 weekly downloads. As such, nativescript-barcodescanner popularity was classified as not popular.
We found that nativescript-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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.