Firebase notifications not working in Android Emulator

喜夏-厌秋 提交于 2020-05-28 13:59:27

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/43562897/firebase-notifications-not-working-in-android-emulator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!