I tried the code in Android Studio and sometimes if I do not scan immediately it will not scan anymore. After I scan a barcode if I close the window with the results, I get the scanning window again but sometime it does not scan any new barcode if some time has elapsed.