Scan error after permission granted
See original GitHub issueDear 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
android.support.v4.content.LocalBroadcastManager.getInstance(LocalBroadcastManager.java:102)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1084)
com.tns.Runtime.callJSMethodImpl(Runtime.java:966)
com.tns.Runtime.callJSMethod(Runtime.java:953)
com.tns.Runtime.callJSMethod(Runtime.java:937)
com.tns.Runtime.callJSMethod(Runtime.java:929)
com.tns.gen.java.lang.Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.onClick(Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.java:12)
android.view.View.performClick(View.java:5340)
android.view.View$PerformClick.run(View.java:21610)
android.os.Handler.handleCallback(Handler.java:815)
android.os.Handler.dispatchMessage(Handler.java:104)
android.os.Looper.loop(Looper.java:207)
android.app.ActivityThread.main(ActivityThread.java:5763)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
here is my scanner code
scanQRCode() {
console.log("scanning");
this.scanner.scan({
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
alert({
title: "Scan result",
message: "Format: " + result.format + ",\nValue: " + result.text,
okButtonText: "OK"
});
},
(errorMessage) => {
console.log("No scan. " + errorMessage);
}
);
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (8 by maintainers)
Top 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 >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
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 asetTimeout
.Thanks! 👍