BarcodeScanner
BarcodeScanner copied to clipboard
Camera Scanner doesn't have Cancel Button in Android
While performing the Barcode scanning using Android device, cancel button is not appearing. Please let us know if there are any configuration option to enable this.
On Android you can use built-in back button. Cancel buttons are generally not needed in Android apps.
in my build built-in back button closes the app...
same for me: back button fires twice and closes the app on S4 4.4.2...
Back button closes app on my Nexus 5 with 4.4.4
Strange... I think it worked fine before. As a workaround you can change location or push state just before you open the scanner and change it back once it finishes. Something like this:
history.pushState({}, "scanner", "#scanner");
runScanner(function(data){
history.go(-1);
...
})
Keep in mind that changing state might affect how you're app works.
some issue here as well, funny enough, if I insert an alert statement in the success handler of the barcode scanner, the issue does not occur.
also the workaround is not working for me as well :(
it seems like the back button is triggered twice after app resume. I made a workaround by temporarily disabling the back button action on barcode scan cancellation and reenabling it once the back button was erroneously fired once.
$window.history.back(-1) [workaround but It causes a strange effect]
@pbernasconi of ngCordova said: "I'm afraid I can't change the functionality of the Camera or BarcodeScanner plugin, so you'll have to submit an issue to the respective repos themselves."
Can you change it?
Thanks In Advance! @wildabeast @Eccenux @filmaj @JaysonRaymond
Same issue here! Pressing back button on android, closes the app. Any solution?
I posted a solution in my comment. Did you try it?
Yeah, and it didn't work. In fact i try to go back in the pushed state when i get a result.cancelled. As a url I pass the id of the div I want to show if the user presses the back button.
One more: back button fires twice. @Eccenux i try your solution, it works but is not pretty.
I am having same problem as well. Back button closes the app. Any solution? S5 and 4.4.2
+1 on LG G2 4.4.2
This works for me, I add an messaje that the scanner was cancelled only with an alert validating the field result.text like this:
function fileViewSuccess(result) { console.log("We got a barcode Result: " + result.text); if(result.cancelled == true){ alert("Was cancelled"); }else{ ///do something... } }