Skip to content

Instantly share code, notes, and snippets.

@Moddus
Last active February 15, 2022 09:23
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Moddus/6400644 to your computer and use it in GitHub Desktop.
Save Moddus/6400644 to your computer and use it in GitHub Desktop.
Android GCM braodcast intent on adb shell to test REGISTRATION

general:

am broadcast -a <Intent-Name> -n <Package>/<Receiver-Name-with-leading-dot> <Extras>

example:

am broadcast -a com.google.android.c2dm.intent.REGISTRATION -n de.example/.GCMBroadcastReceiver 
--es "registration_id" "1234"

explanation: --es define extra as string

full command:

adb shell am broadcast -a com.google.android.c2dm.intent.REGISTRATION 
-n de.example/.GCMBroadcastReceiver --es "registration_id" "1234"

testing:

uncomment android:permission="com.google.android.c2dm.permission.SEND" from your broadcast receiver configuration.

more details:

adb shell am help for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment