BeepManager plays two beeps sometimes
See original GitHub issueI create a customized continuous capture activity and am using the beep manager to play a sound when a new barcode is scanned. However, sometimes the beep manager plays the beep sound more than once even though it gets called only once.
Here is what I have in my BarcodeCallback.barcodeResult function:
if(Config.getInstance().addBarCode(result.getText())) { //synchronized method!
Log.i("MjMTest", "Played sound for: " + result.getText());
beepManager.playBeepSoundAndVibrate();
}
As seen, the barcode is added to a config instance. This adds it to a synchronized list to make sure it doesn’t get added more than once if it has already scanned. It then prints to the log that it has played a sound for X barcode, then plays the sound. In my logs, I will only get the output for the log printed once, but the beep sound will still play twice. The two beeps usually happen on the first barcode I can, but sometimes happen on other barcodes after the first scan as well.
Is there anything I am missing? Or is the beep manager a bit buggy like this sometimes? Thanks for any help
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@mjmfighter can you reproduce it?? I am also using BeepManager but i didn’t see any problem, there might be your barcode scanned two times frequently, you can have a check if barcode scanned first time then stop immediately scanning.
This should be fixed with #221 now - thanks @roxma.