4

I'm trying to use Google cloud messaging for an android app (Target name: Google APIs, platform: 4.3, API level: 18.

I implemented my GCM client by following the isntructions here: http://developer.android.com/google/gcm/client.html,

and setup play services by following the steps here: http://developer.android.com/google/play-services/setup.html#Setup, but still get the above error

Most of the solutions I've found on stack overflow redirect to the above two links, or suggest that we change the dependencies {} in the gradle settings, but I'm using eclipse and don't have gradle setup.

Update: Sorry yes I'm using the emulator and not a device

Any ideas?

Thanks!

user2635088
  • 1,598
  • 1
  • 24
  • 43

2 Answers2

3

If you need to provide an option for the user to update the google services you can do this:

   switch (isGooglePlayServicesAvailable(this)) {
        case 2: //out date
            try {
                GooglePlayServicesUtil.getErrorDialog(2, this, 0).show();
            } catch (Exception e) {
                e.printStackTrace();
            }
            break;

    }

This will prompt an update dialog for the user to update play services

Pedro Oliveira
  • 20,442
  • 8
  • 55
  • 82
  • Hi since I'm using the emulator I get a popup asking me to update but when I click on update nothing happens – user2635088 Sep 12 '14 at 14:37
  • 1
    That's because it's an emulator. You have to create a new emulator with the new google api version. Remember to update your SDK first – Pedro Oliveira Sep 12 '14 at 14:39
  • In my SDK manager, I have Android 4.4.2 (API 19), ANdroid 4.4W (API 20), and Android L (API 20) not currently installed - which one should I install? – user2635088 Sep 12 '14 at 14:54
  • 1
    You need to use a Google API system image – Pedro Oliveira Sep 12 '14 at 15:03
  • Thank you! The final solution was creating a new emulator under Android 4.4.2, with the build target of the project set to Google APIs (x86 System Image) – user2635088 Sep 13 '14 at 11:05
3

The final solution was creating a new emulator under Android 4.4.2, with the build target of the project set to Google APIs (x86 System Image). Thanks to Pedro Oliveira!

user2635088
  • 1,598
  • 1
  • 24
  • 43