I've been testing my application with a slow but working 3G connection and found out that the GCM response is failing almost everytime I request to get my device token id.
It works perfectly with a good Wi-Fi connection.
This is how I'm getting the token:
procedure TFormLogin.Timer_GetTokenTimer(Sender: TObject);
begin
{$IFDEF ANDROID}
APushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.GCM);
APushService.AppProps[TPushService.TAppPropNames.GCMAppID] := GCM_APP_ID;
{$ELSE }
APushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.APS);
{$ENDIF }
try
AServiceConnection := TPushServiceConnection.Create(APushService);
AServiceConnection.Active := true;
AdeviceToken := APushService.DeviceTokenValue[TPushService.TDeviceTokenNames.DeviceToken];
except
on E: Exception do
ShowMessage(E.Message);
end;
end;
Is there anything I can do to improve this procedure when the user connection is too slow?
Note: Apple Push Service is working fine with a slow connection.