I am emulating a Broadcast Intent via ADB Tool, One of the intents extras value is a JASON, The Jason string is broken after the first comma and I'm not getting the rest of the string.
The shell command I am using:
adb shell am broadcast -a com.google.android.c2dm.intent.RECEIVE -n com.example.fx/com.example.fx.utils.gcm.GcmBroadcastReceiver --es "custom" "{"time":"2014-12-08T15:11:19,event_type":"m","event_id":"1418051429_1418051479"}"
The code I use to get the string from the intent :
String payload = intent.getStringExtra("custom");
The result I get:
"time:2014-12-08T15:11:19"
Does anyone know why this happens and a way around it?
Thanks in advance
I had the same problem and worked around it by first running adb -e shell, and then sending my broadcasts from that session.
Had the same problem, solved it using
Alex P.
's comment:Make sure you switch the
"
with'
and vice versa in you "raw" JSON strings.Make sure you're not using
`
around your strings.Make sure that the outer-most "wrapper" of your string consists of
'
.To summarize:
This didn't work:
This did work: