Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase notifications not working in Android Emulator

I am developing an Android app which uses Firebase to send notifications. Everything works as expected when using my physical device (Google Nexus 5, and also tested on others), but I cannot receive notification when using the emulator.

Platform: Windows Android Studio: 2.3.1 with Google Play Services 39 API: 24 Emulator: Nexus 6 API 24, Android 7.0

Any idea?

like image 587
peval27 Avatar asked Apr 22 '17 18:04

peval27


People also ask

Do push notifications work on Android emulator?

You can also test push notifications in the Android emulator. Like the iOS Simulator, it can register for notifications and display them.

Does FCM work on emulator?

Stay organized with collections Save and categorize content based on your preferences. FCM clients require devices running Android 4.4 or higher that also have the Google Play Store app installed, or an emulator running Android 4.4 with Google APIs.


1 Answers

Have you tried using different emulator configurations, targeting the emulator from the Firebase console using the single device option with the generated Firebase instance token, verifying Firebase notification status for the messages are marked complete? Are you sending a background notification when the app is in the foreground? Are you sure Google Play Services are available on the emulator?

The single device option will probably help you the most when you debug. Repeat these steps as you make small incremental changes to your code:

  1. Log the emulator’s Firebase instance token
  2. Navigate to the notification page of your app in the Firebase console
  3. Click new message
  4. Add your message text
  5. Under Target, select single device
  6. Paste the Firebase registration token you logged in step 1, into the textbox
  7. Make sure your app is running in the background
  8. Send the message
like image 152
steepestascent Avatar answered Oct 18 '22 20:10

steepestascent