Search code examples
javaandroidbarcode

Listener for barcode scanning event


How can I implement a listener in Java for my Android foreground service that can detect barcode scanning event and save a resulting barcode to a text file, or display a message when barcode scanned with the barcode.

I already created a foreground service. Is it even possible to have a foreground service with a listener which listens to events when other app (warehouse app) scans a barcode? Our company only needs to additionally to save a barcode with time of scanning to a database.


Solution

  • Is it even possible to have a foreground service with a listener which listens to events when other app (warehouse app) scans a barcode?

    Generally speaking, no. The other app is unlikely to be making that information available to arbitrary apps like yours, for privacy and security reasons.

    If you know the authors of this "warehouse app" or can otherwise communicate with them, you might ask them if they have any sort of SDK or other way of having your app integrate safely and securely with theirs.