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.

Scan error after permission granted

See original GitHub issue

Dear Eddy,

Thanks for building this plugin, I just try to implement this plugin in my tns-angular project.

Just before scan performed, it ask for camera permission, but after it granted, the following error shown up

No scan. Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
    com.tns.Runtime.callJSMethodNative(Native Method)
    java.lang.reflect.Method.invoke(Native Method)$

here is my scanner code

scanQRCode() {

            formats: "QR_CODE",
            message: "Use the volume buttons for extra light",
            showFlipCameraButton: true,   // default false
            showTorchButton: true,        // default false
            closeCallback: () => { console.log("Scanner closed") },
            resultDisplayDuration: 500
        }).then((result) => {
              // Note that this Promise is never invoked when a 'continuousScanCallback' function is provided
                title: "Scan result",
                message: "Format: " + result.format + ",\nValue: " + result.text,
                okButtonText: "OK"
            (errorMessage) => {
                console.log("No scan. " + errorMessage);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

EddyVerbruggencommented, Sep 12, 2017

Hi! At what point do you call scanQRCode? Do you trigger it from a button, or during app startup? In case of the latter try to move the code to your first viewcontroller, or wrap it in a setTimeout.

EddyVerbruggencommented, Jul 18, 2018

Thanks! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

QR scanner fails on first scan after giving permission. #888
The same issue as this one: #717 -> Open page with qr scanner -> App asks for permission -> Permission granted (Previously white...
Read more >
Scanning Problem With Scan App... - Microsoft Community
Open Windows explorer and navigate to the following location : C:\Users\UserName\Pictures\Scans · Right click on the folder and select Properties ...
Read more >
Apple Says Fix Planned for 'You Do Not Have Permission to ...
Apple Says Fix Planned for 'You Do Not Have Permission to Open the Application' Error When Using a Scanner on Mac [Updated].
Read more >
Bluetooth LE Scan fails in the background - permissions
Starting with Android M, Bluetooth LE scanning in the background is blocked unless the app has one of the following two permissions:
Read more >
Cloud - ScanIt - an Error when trying to log in as end user
Go to Permission Set page and search for WADACO_MOBILE_USER permission set and select the Projections item from the record selector. · Grant “ ......
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