57

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.

Christopher Lawless
  • 1,057
  • 2
  • 12
  • 19

6 Answers6

32

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

iflorit
  • 740
  • 5
  • 10
  • 6
    And there is any google account set in your emulator? – iflorit Dec 11 '13 at 14:50
  • 2
    Is your Android project compiled using a Google APIs target too? I think is necessary for testing – iflorit Dec 11 '13 at 15:03
  • it is now, didn't help unfortunately, i'll keep plugging away maybe i'll find something. – Christopher Lawless Dec 11 '13 at 15:35
  • 1
    I wasn't using the Google API that was the issue, i was trying to use an intel build for the hardware acceleration if provides but because this didn't exist for the Google API android build the AVD manager was defaulting back to the Android core API, something i hadn't noticed. – Christopher Lawless Dec 16 '13 at 17:27
  • 2
    Also don't forget to add in your app gradle the following: apply plugin: 'com.google.gms.google-services' – Vinicius Lima May 13 '16 at 00:50
23

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

enter image description here

David Douglas
  • 10,377
  • 2
  • 55
  • 53
  • How did you get the "Google APIs" target? I don't see it on the latest Eclipse with latest ADT plugin. – faizal Oct 02 '14 at 15:19
  • 6
    Try installing additional APIs using Android SDK Manager. You will also need Google Play Services installed. I have a video showing this https://www.youtube.com/watch?v=Zx78vrELgXk – David Douglas Oct 06 '14 at 07:50
  • ahh thanks. nice video. I had never noticed the Google APIs system images in the SDK manager. – faizal Oct 09 '14 at 04:30
  • @DavidDouglas you should mention as "Google APIs system images" there will be more clear. There is also "Google APIs" listed which is confusing. – Teoman shipahi Jan 26 '16 at 22:01
16

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

Victor Mwenda
  • 1,677
  • 17
  • 16
13

Ensure you connected a google account on the emulator

frapeti
  • 1,090
  • 13
  • 18
5

My solution: Allow notifications in settings. Some emulators are denied by default.

enter image description here

Terry
  • 29
  • 1
  • 2
1

If you reach her, then you can try this answer.

Noting that no need to login in emulator with any google account.