Search code examples
androidandroid-intentadb

Sending Intent using ADB


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?


Solution

  • 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