BarcodeScanner icon indicating copy to clipboard operation
BarcodeScanner copied to clipboard

Camera Scanner doesn't have Cancel Button in Android

Open DhruvaBhaskara opened this issue 11 years ago • 15 comments

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.

DhruvaBhaskara avatar Sep 09 '14 05:09 DhruvaBhaskara

On Android you can use built-in back button. Cancel buttons are generally not needed in Android apps.

Eccenux avatar Sep 11 '14 11:09 Eccenux

in my build built-in back button closes the app...

fgrs avatar Sep 17 '14 13:09 fgrs

same for me: back button fires twice and closes the app on S4 4.4.2...

carricha avatar Sep 21 '14 09:09 carricha

Back button closes app on my Nexus 5 with 4.4.4

nraboy avatar Sep 24 '14 02:09 nraboy

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.

Eccenux avatar Sep 28 '14 08:09 Eccenux

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.

Freundschaft avatar Nov 02 '14 22:11 Freundschaft

$window.history.back(-1) [workaround but It causes a strange effect]

danicomas avatar Nov 26 '14 17:11 danicomas

@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

danicomas avatar Nov 27 '14 10:11 danicomas

Same issue here! Pressing back button on android, closes the app. Any solution?

vasnakos avatar Dec 22 '14 15:12 vasnakos

I posted a solution in my comment. Did you try it?

Eccenux avatar Dec 27 '14 17:12 Eccenux

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.

vasnakos avatar Dec 29 '14 12:12 vasnakos

One more: back button fires twice. @Eccenux i try your solution, it works but is not pretty.

lmribeiro avatar Jan 08 '15 16:01 lmribeiro

I am having same problem as well. Back button closes the app. Any solution? S5 and 4.4.2

itsmebhavin avatar Apr 28 '15 21:04 itsmebhavin

+1 on LG G2 4.4.2

ghost avatar Sep 11 '15 20:09 ghost

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

skyneverdies avatar Jan 18 '18 22:01 skyneverdies