i'm trying to implement push notifications in my android app but i'm currently stuck at the point of receiving a token.
I'm using the latest method of "InstanceID" and followed some examples. I've added the permissions and the services to my Manifest ( and added the code for them aswell ) but whatever i try, i always get the "java.io.IOException: TIMEOUT" error. I've tried different phones, wifi, Lte and 3G but nothing seems to change anything.
I never got to the error saying "SERVICE_NOT_AVAILABLE". Only stuck at this one.
Manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="de.company.appname" />
</intent-filter>
</receiver>
<service
android:name="de.company.gcm.ModuleGCMListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="de.company.gcm.ModuleInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
InstanceID call:
try
{
token = instanceID.getToken(
senderId,
GoogleCloudMessaging.INSTANCE_ID_SCOPE,
null);
}
catch (IOException e)
{
e.printStackTrace();
}
instanceID.getId() is working.
W/InstanceID/Rpc: No response android.os.ConditionVariable@129d5713
W/System.err: java.io.IOException: TIMEOUT
W/System.err: at com.google.android.gms.iid.zzc.zzb(Unknown Source)
W/System.err: at com.google.android.gms.iid.zzc.zza(Unknown Source)
W/System.err: at com.google.android.gms.iid.InstanceID.zzc(Unknown Source)
W/System.err: at com.google.android.gms.iid.InstanceID.getToken(Unknown Source)
InstanceID.getToken()is here. - bjiang