EdwardvanRaak / MaterialBarcodeScanner

Easy to use barcode reader for your Android Project (Uses Google Mobile Vision API)
Apache License 2.0
272 stars 113 forks source link

How to stop it programmatically? #61

Open smilelyj opened 5 years ago

smilelyj commented 5 years ago

Hi,

I am trying to add a timer to stop the scanner after 30 seconds. Could you tell me how to stop the scanner programmatically? Many thanks!!!

Yongji

lucazin commented 5 years ago

make a timer and close the activity

Em seg, 26 de nov de 2018 às 20:29, Yongji Li notifications@github.com escreveu:

Hi,

I am trying to add a timer to stop the scanner after 30 seconds. Could you tell me how to stop the scanner programmatically? Many thanks!!!

Yongji

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EdwardvanRaak/MaterialBarcodeScanner/issues/61, or mute the thread https://github.com/notifications/unsubscribe-auth/Aa9RlhKh9_o33Yw3g0y9DjhFN2d4gNbWks5uzGsrgaJpZM4Yz9DU .

smilelyj commented 5 years ago

make a timer and close the activity Em seg, 26 de nov de 2018 às 20:29, Yongji Li notifications@github.com escreveu: Hi, I am trying to add a timer to stop the scanner after 30 seconds. Could you tell me how to stop the scanner programmatically? Many thanks!!! Yongji — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#61>, or mute the thread https://github.com/notifications/unsubscribe-auth/Aa9RlhKh9_o33Yw3g0y9DjhFN2d4gNbWks5uzGsrgaJpZM4Yz9DU .

Thanks for your reply! Here is my use case: Activity A call Activity B with this Scanner to scan barcode. But if I try to close the activity b by using either onBackPressed() or finish(), activity B is closed but the camera is still open. getCameraSource.stop() or release() doesn't work for me too. I am so confused.