我正在按照本教程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,我使用的是与本文所附的源代码相同的代码。