oney / react-native-gcm-android

GCM for React Native Android
MIT License
172 stars 76 forks source link

MISSING_INSTANCEID_SERVICE #21

Open cpsiaki opened 8 years ago

cpsiaki commented 8 years ago

This is the adb logcat i get when I reach the spot in code where I call GcmAndroid.addEventListener('register'....

01-06 09:00:03.885  5066  5172 D GcmRegistrationService: Failed to complete token refresh
01-06 09:00:03.885  5066  5172 D GcmRegistrationService: java.io.IOException: MISSING_INSTANCEID_SERVICE
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at com.google.android.gms.iid.zzc.zza(Unknown Source)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at com.google.android.gms.iid.zzc.zzb(Unknown Source)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at com.google.android.gms.iid.zzc.zza(Unknown Source)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at com.google.android.gms.iid.InstanceID.zzc(Unknown Source)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at com.google.android.gms.iid.InstanceID.getToken(Unknown Source)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at com.oney.gcm.GcmRegistrationService.onHandleIntent(GcmRegistrationService.java:38)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at android.os.Handler.dispatchMessage(Handler.java:102)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at android.os.Looper.loop(Looper.java:148)
01-06 09:00:03.885  5066  5172 D GcmRegistrationService:    at android.os.HandlerThread.run(HandlerThread.java:61)

what am I missing?

I have the google-services.json in my android/app/ directory I edited all the appropriate files as listed in the readme

I am using Parse as my backend. But I don't think this should have anything to do with it as I haven't yet sent the token up to parse because I can't get it.

oney commented 8 years ago

What device do you test?

cpsiaki commented 8 years ago

I'm actually testing on a genymotion sim. I was told it would work by I can't remember who. That could be the problem. Not sure why I didn't consider that. I'll go buy a droid tablet this weekend.

oney commented 8 years ago

I guess the issue is related to Genymotion simulator. You can try installing Google Play service to Genymotion by follwinng the link

cpsiaki commented 8 years ago

So the emulator, regardless of whether react-native-gcm-android is making the right calls, can't talk to GCM without a special plugin?

I did install the correct packages from the android system on my mac. (by typing 'android' on my mac terminal)

what sort of environment do you test with? Do you use a device?

oney commented 8 years ago

I think so. GCM is a service from Google Play, so we have to make sure the device/emulator has Google Play service before using it. I have tried testing on Genymotion emulator without installing Google Play service before, and get the same error. Basically, I develop the app on a device.

jawadrehman commented 8 years ago

@cpsiaki you can try using the google apis intel emulator (x86) using the android avd . it was working great with GCM.