I\'m attempting to broadcast extras in an am broadcast in adb shell. In my BroadcastReceiver in android, I\'m subscribed to the broadcast and pull the extras out of the Bund
You can use URI
format to provide <INTENT>
to am broadcast
and am startservice
:
adb shell am broadcast "intent:#Intent;action=android.intent.action.YOUR_ACTION;d.percent_complete=99.999;end"
URI
format supports the following extra
types:
Bundle b = intent.mExtras;
if (uri.startsWith("S.", i)) b.putString(key, value);
else if (uri.startsWith("B.", i)) b.putBoolean(key, Boolean.parseBoolean(value));
else if (uri.startsWith("b.", i)) b.putByte(key, Byte.parseByte(value));
else if (uri.startsWith("c.", i)) b.putChar(key, value.charAt(0));
else if (uri.startsWith("d.", i)) b.putDouble(key, Double.parseDouble(value));
else if (uri.startsWith("f.", i)) b.putFloat(key, Float.parseFloat(value));
else if (uri.startsWith("i.", i)) b.putInt(key, Integer.parseInt(value));
else if (uri.startsWith("l.", i)) b.putLong(key, Long.parseLong(value));
else if (uri.startsWith("s.", i)) b.putShort(key, Short.parseShort(value));
else throw new URISyntaxException(uri, "unknown EXTRA type", i);