Scanenr freez android app if hit back button or navigate to another page
See original GitHub issueWhen I am in the scanner on Android device and click back button it close scanner and I am not able to use app for few seconds it just freezs. Also it triggers error message: “Error when scanning Scan aborted”.
Here is my code:
public onScan() {
this.getScanner();
}
private getScanner() {
this.barcodeScanner.scan({
formats: "QR_CODE, EAN_13",
cancelLabel: "Zatvori skener",
showFlipCameraButton: false,
preferFrontCamera: false,
showTorchButton: true,
beepOnScan: true,
torchOn: false,
resultDisplayDuration: 500,
message: "Skenirajte QR kod da bi pristupili meniju",
closeCallback: () => { console.log("Scanner closed") },
openSettingsIfPermissionWasPreviouslyDenied: true //ios only
}).then((result: any) => {
const qrDecoded = JSON.parse(result.text);
this.qrEmitter.emit(qrDecoded);
}, (errorMessage) => {
console.log("Error when scanning " + errorMessage);
}
)
.catch((error) => {
console.log('cathced error', error);
});
}
I am using Angular and Nativescript
Edit: I think I found here some solution: https://stackoverflow.com/questions/38664956/in-fragment-how-to-stop-camera-of-zxing-scanner But don’t know how to implement in plugin
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Navigation Bar for Android - Apps on Google Play
“Navigation Bar for Android” application can replace a failed and broken button for those people who has trouble using buttons or navigation bar...
Read more >How to invoke QR code scanner when back button is pressed?
First: In LoginActivity check every time in your database if you are logged in, if so go to ScanActivity directly. Second: Open scan...
Read more >Tasks and the back stack | Android Developers
A task is a collection of activities that users interact with when trying to do something in your app. These activities are arranged...
Read more >Cancelling barcodescanner returns two pages back on ...
Expected Behaviour When barcodescanner is cancelled, the display should go back to the previous page and close the scanner Actual Behaviour ...
Read more >WebView and Android back button navigation - LogRocket Blog
If you have a page opened and you click on Android's back button, ... Instead, it will navigate inside the application itself, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Add marking mode none in package.json in src file like this
Thanks! I use that all the time as well, and it seems to be the default in {N} these days, so closing. Not much the plugin can do about it anyway… and since it’s the default now there’s not much sense in documenting it. Still, folks searching for a similar issue on this repo will likely find this issue and your solution. 👍