获取Firebase设备令牌android delphi 10.2

时间:2018-08-28 19:22:57

标签: android delphi google-cloud-messaging delphi-10.2-tokyo

我正在按照本教程http://thundaxsoftware.blogspot.com/2017/01/firebase-cloud-messaging-with-delphi.html使用推送通知,

 {$IFDEF ANDROID}
   PushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.GCM);
  PushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '71553856XXXX';
{$ENDIF}
  ServiceConnection := TPushServiceConnection.Create(PushService);
  //ServiceConnection.Active := True; //Update
  ServiceConnection.OnChange := OnServiceConnectionChange;
  ServiceConnection.OnReceiveNotification := OnReceiveNotificationEvent;
  ServiceConnection.Active := True; 

  DeviceId := PushService.DeviceIDValue[TPushService.TDeviceIDNames.DeviceId];
  DeviceToken := PushService.DeviceTokenValue[TPushService.TDeviceTokenNames.DeviceToken];
  Memo1.Lines.Add(DateTimeToStr(Now) + ' DeviceID: ' + DeviceId);
  Memo1.Lines.Add(DateTimeToStr(Now) + ' FCM Token: ' + DeviceToken);
  Memo1.Lines.Add(DateTimeToStr(Now) + ' Ready to receive!');

DeviceToken为空!但是显示了设备ID,我使用的是与本文所附的源代码相同的代码。

0 个答案:

没有答案