bela.waeckerlig bela.waeckerlig - 28 days ago 11
Android Question

Sending JSON as extra data in an android broadcast via ADB gets incorrectly formatted

I'm trying to send JSON data as extra on an Android broadcast wich i send via ADB to the device. But it looks like the data which gets to the device is not as expected.

What I execute:

adb shell am broadcast -a -n -e "notify" '{"debug": false, "title": "Application update!"}'

What I expect as extra data:

{"debug": false, "title": "Application update!"}

What I get as extra data:

"debug": false

If I send
{"debug": false "title": "Application update!"}
as extra data then i get
{"debug": false "title": "Application update!"}
as extra data (noting the missing comma). So i assume it has something to do with Brace Expansion of my bash, but turning it off does not solve the problem and escaping the braces or the comma is not working.

Does anybody has a clue what am I doing wrong?


ok, I just found a solution. I first have to enter the devices shell via adb shell and then execute am broadcast -a -n --es "notify" '{"debug": false, "title": "Application update!"}'