Open evernikovskiy opened 7 years ago
I need the same feature also. But failed to implement also.
Tried
Thousand thanks if anyone got idea how to close the scanner from controller.
I need this feature too.
I was unable to find any solution or workaround for this... In my case I want to scan for nfc and barcode at the same time and close the barcodescanner if a nfc tag was found.
Would be great to know if this is even possible or if someone could find a solution for this!
For anyone looking to implement this: I've added support for stopping scanning to the Android library because I needed it in my NativeScript plugin that uses the same native lib. What's missing is similar code like this in the Android plugin Class. On iOS it's probably a matter of dismissing the camera viewcontroller.
I have the same problem,Any solutions ? Especially the android.
+1
I have the same issue. But I add a function to fix it. Like this:
javascript:
cordova.plugins.barcodeScanner.exit();
java:
else if (action.equals(EXIT)){ Intent backIntent = new Intent(cordova.getActivity().getBaseContext(), MainActivity.class); backIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); cordova.startActivityForResult(this, backIntent, REQUEST_CODE); return false; }
@MontyZhao would you mind sharing your JS code for this? It would help me a lot. Thanks!
Or did anyone find a solution for this. It would be very useful for my app.
So, am I correct to assume there is no way cancel, close, exit, or idle close the scanning feature? on both android and ios?
did anyone end up figuring it out ?
Expected Behaviour
In a case the scanner screen has been opened in a kiosk application by an external user, it would be great to have an API call which allows the application to close the scanner screen from the code (from a timeout callback for example).
Actual Behaviour
The current implementation keeps the scanner screen opened until the user scans a bar code or taps the Cancel button. It makes it impossible for the application to navigate back to the home screen in case the device has been left unattended.
Plugin version
6.0.6
Sample Code that illustrates the problem
// Desired API: cordova.plugins.barcodeScanner.stop();