1

I've been following the guide for creating an android app that listens for a barcode reader here:

https://developer.motorolasolutions.com/community/android/android-forums/android-blogs/blog/2014/11/06/scanning-barcodes-in-your-xamarin-android-app

I'm trying to debug listening for the barcodescanner.RECVR intent - my phone is connected via USB and is debugging as expected as i can see the device by calling adb devices and can see the log from the phone. But when i try and broadcast the intent using adb, nothing appears to happen:

adb shell am broadcast -a wmsmobileapp.activities.MainActivity -c android.intent.category.DEFAULT -d "some data"

returns:

Broadcasting: Intent { act=wmsmobileapp.activities.MainActivity cat=[android.intent.category.DEFAULT] dat=NOR1-A1-FA-S1-B1 }
Broadcast completed: result=0

I'm pretty new to android development so am pretty lost with trying to emulate broadcasting an intent. Is my command wrong or is there something else I'm missing?

CatBusStop
  • 3,347
  • 7
  • 42
  • 54

1 Answers1

1

After some trial and error - I figured out the adb command:

adb shell am start -a barcodescanner.RECVR -c android.intent.category.DEFAULT -n WMSMobileApp.WMSMobileApp/wmsmobileapp.activities.MainActivity -e com.motorolasolutions.emdk.datawedge.source scanner -e com.motorolasolutions.emdk.datawedge.data_string 508919007526
CatBusStop
  • 3,347
  • 7
  • 42
  • 54
  • 1
    It appears you had mixed up the component and the action in the original. But note that what you are doing here is no longer a *broadcast*. – Chris Stratton Mar 17 '15 at 16:05
  • True, turns out broadcast was the problem. It's a little difficult to work out what is going on as the example uses an additional app, DataWedge, which acts as the interface for the hardware and then passes the data via an intent. Switching the component and action and changing broadcast to start gave me what I needed :) – CatBusStop Mar 17 '15 at 16:42