0
APushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.GCM);
APushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '"XXXXXXX" '; SENDER ID from Console Firebase
AServiceConnection := TPushServiceConnection.Create(APushService);
AServiceConnection.Active := True;
AServiceConnection.OnChange := OnServiceConnectionChange;
AServiceConnection.OnReceiveNotification := OnReceiveNotificationEvent;

ADeviceID := APushService.DeviceIDValue[TPushService.TDeviceIDNames.DeviceID];
AdeviceToken := APushService.DeviceTokenValue[TPushService.TDeviceTokenNames.DeviceToken];

I am using the SENDER ID correctly, and ADeviceID comes up correctly, but ADeviceToken comes up blank. I am getting this error:

image

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • 1
    Why are you surrounding the sender ID with quotes and spaces? Also, are you calling this code in the main UI thread or in a worker thread? Non-UI work should not be in the main UI thread. – Remy Lebeau Apr 17 '17 at 15:24
  • The quotes and spaces is a error typing this question. This example is the same that : http://thundaxsoftware.blogspot.pe/2017/01/firebase-cloud-messaging-with-delphi.html. Just using Delphi 10.2 Tokyo. This error appear when try request the token. – Jose Castillo Reyes Apr 17 '17 at 23:54
  • 1
    Based from this [thread](http://stackoverflow.com/a/17726069/5832311), the error `java.io.IOException: MAIN_THREAD` means that you are calling the register method from the main thread, which is not allowed. You should call it from another thread. You can check this [Handling Firebase Cloud Messaging on Android and iOS](https://delphiworlds.com/2017/04/firebase-cloud-messaging-android-ios/) tutorial. – abielita Apr 18 '17 at 07:20

0 Answers0