Android 模拟器未收到推送通知

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20521600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:58:28  来源:igfitidea点击:

Android emulator not receiving push notifications

androidpush-notificationgoogle-cloud-messaging

提问by Christopher Lawless

I'm using push notifications on google cloud, however for some reason i cant receive push notifications on the emulator.

我在谷歌云上使用推送通知,但是由于某种原因我无法在模拟器上收到推送通知。

The same application does receive notifications when i test it on a real device however.

然而,当我在真实设备上测试时,同一个应用程序确实会收到通知。

Has anyone else encountered this or found solutions to it? the emulated device has net access and is the same android version as the real one so i cant think of any reason it shouldn't work.

有没有其他人遇到过这个问题或找到了解决方案?模拟设备具有网络访问权限,并且与真实设备的 android 版本相同,所以我想不出它不应该工作的任何原因。

采纳答案by iflorit

Which target have your emulator? For Google Services like GCM, use a "Google APIs" (any version) target to receive push notifications

哪个目标有你的模拟器?对于 GCM 等 Google 服务,使用“Google APIs”(任何版本)目标来接收推送通知

回答by David Douglas

Edit your Android Virtual Machine (AVD) Target to use 'Google APIs' to enable GCM Push Notifications to be received by the emulator.

编辑您的 Android 虚拟机 (AVD) 目标以使用“Google API”来启用模拟器接收 GCM 推送通知。

enter image description here

在此处输入图片说明

回答by frapeti

Ensure you connected a google account on the emulator

确保您在模拟器上连接了谷歌帐户

回答by Victor Mwenda

Was your emulator receiving Firebase push notifications before? If yes, force reboot your emulator.

您的模拟器之前是否收到 Firebase 推送通知?如果是,请强制重启您的模拟器。