0

When I am trying to get GCM token InstanceId throws an IOException.

I have this issue only on nexus devices 4 and 5 Google play services = 8.4.0 android 5.1.1 and 6.0.1

On samsung devices I can get GCM token and receive push messages.

String token = InstanceID.getInstance(mContext)
                    .getToken(defaultSenderId, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);

W/GCM: Missmatched messenger
W/System.err: java.lang.RuntimeException: java.io.IOException: TIMEOUT
Ravi
  • 34,851
  • 21
  • 122
  • 183
wnc_21
  • 1,751
  • 13
  • 20

2 Answers2

0

Try invoking the getToken() method on another thread instead of main thread, like:

new Thread(new Runnable() {
    public void run() {
        //code
    }
}).start();
Prerak Sola
  • 9,517
  • 7
  • 36
  • 67
0

It seems that problem is with our VPN. I don't know what's wrong, but without VPN everything works fine, thank you guys.

wnc_21
  • 1,751
  • 13
  • 20