1

I'm facing an issue with GCM device registration, but it seems to be limited to devices running Android version 5.0 (Lollipop).

I've been able to test push notifications successfully on all other devices except those running Lollipop. I am consistently getting the GCM SERVICE_NOT_AVAILABLE error.

I'm trying to run GCM.register(...) from within my launcher activity. Again, this runs perfectly on all devices except those with Android Lollipop.

I've got all the correct manifest intent-filter actions and permissions (as are documented in many other posts).

Anyone have any ideas on what could be going wrong here?

Here is the AsyncTask running the registration:

        protected Object doInBackground(final Object... params) {

            try {
                String token = mGCM.register(getString(R.string.project_number));
                Log.i("registrationId", token);
            } catch (IOException e) {
                Log.i("Registration Error ", e.getMessage());
            }
            return true;
        }

        @Override
        protected void onPostExecute(Object o) {
            super.onPostExecute(o);
            // do something
        }
Lady_ari
  • 433
  • 3
  • 8
  • 19
  • What actual devices are you testing with on Lollipop? – 323go Feb 02 '15 at 19:01
  • See if this help you http://stackoverflow.com/questions/25129611/gcm-register-service-not-available – Rohit5k2 Feb 02 '15 at 19:02
  • @323go I'm using GenyMotion emulators running 5.0.0. Google nexus 9 & Google Nexus 5, specifically. Those are the ones that GenyMotion supports running 5.0.0 – Lady_ari Feb 02 '15 at 19:11
  • There usually aren't Google Services (including GCM) installed on the emulators. Use a device. – 323go Feb 02 '15 at 20:25
  • 1
    possible duplicate of [Google Play Services Missing in Emulator (Android 4.4.2)](http://stackoverflow.com/questions/22141043/google-play-services-missing-in-emulator-android-4-4-2) – 323go Feb 02 '15 at 20:26

1 Answers1

1

Are you using the GooglePlayServices system image for Lollipop? AFAIK you need to run these PlayServices-enabled images to use the APIs in the emulator.

  • Of course. Stupid oversight. I've installed google play services on the emulator and am seeing a registration id being returned. – Lady_ari Feb 02 '15 at 20:27