I'm developing an Android app listening for specific intent containing a bundle with some data. I would like to send an intent to my app using adb. I have tried with:
adb shell am startservice -a com.INTENT_NAME -e myBundleName myBundleData com.pkg/com.pkg.cls
but my app recognised it as list of string not as a bundle. Does anyone know how to send intent with bundles using am application? Unfortunately documentation says only about sending lists of string or numbers, nothing about bundle.
You can start it by using the following command: adb shell am startservice -a android.intent.action.MAIN -e "key" "value" -n com.example.test/.TestService Key and value should be your bundle values you want to send. TestService should be your ServiceName Add for your Service in androidmanifest.xml Snippet:
I was facing the same issue, trying to fake the situation where you've just installed an app after receiving a Facebook App Invite. Couldn't get the shell to work, ended up building a really simple test rig that had one button and handler code like:
According to the source code
am
has no way of accepting input data of thebundle
typeUpdate: In Android 7.0 the intent parameters parsing code has been moved from Am.java to Intent.java and support for more data types (like
Array[]
andArrayList<>
of basic types) has been added. Unfortunately there is still no support for theBundle
type extras inam
command.