Forrest logo
back to the adb tool

android:warp:ee60086b3db8b82fd15183502fca6d7f

Send a Firebase push notification to a local Android emulator
$ adb shell am broadcast \ -n ${your_app_package_name}/com.google.firebase.iid.FirebaseInstanceIdReceiver \ -a "com.google.android.c2dm.intent.RECEIVE" \ --es "title" "${notification_title}" \ --es "body" "${notification_body}" \ --es "deeplink" "${deeplink}"
try on your machine

This command is using the Android Debug Bridge (adb) to send a broadcast intent to a specific app on an Android device. Here is a breakdown of the command:

  • adb shell am broadcast: This is the adb command to send a broadcast intent.
  • -n ${your_app_package_name}/com.google.firebase.iid.FirebaseInstanceIdReceiver: This specifies the target component to receive the broadcast intent. ${your_app_package_name} should be replaced with the package name of your app. In this case, the intent will be received by the FirebaseInstanceIdReceiver class in the com.google.firebase.iid package.
  • -a "com.google.android.c2dm.intent.RECEIVE": This specifies the action of the broadcast intent. In this case, it is set to "com.google.android.c2dm.intent.RECEIVE", which is a common action used for receiving push notifications via Firebase Cloud Messaging (FCM).
  • --es "title" "${notification_title}": This sends an extra string data to the broadcast intent with the key "title". The value of ${notification_title} should be replaced with the actual notification title you want to send.
  • --es "body" "${notification_body}": This sends another extra string data with the key "body". The value of ${notification_body} should be replaced with the actual notification body text you want to send.
  • --es "deeplink" "${deeplink}": This sends an extra string data with the key "deeplink". The value of ${deeplink} should be replaced with the actual deep link URL you want to send.

Overall, this command is used to simulate sending a push notification to a specific app on an Android device using adb.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the adb tool