Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scanenr freez android app if hit back button or navigate to another page

See original GitHub issue

When 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() {

  private getScanner() {
      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);
    }, (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: But don’t know how to implement in plugin

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

vforvcommented, Mar 14, 2019

Add marking mode none in package.json in src file like this

"android": {
    "v8Flags": "--expose_gc",
    "markingMode": "none"
EddyVerbruggencommented, Apr 11, 2019

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. 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found