需要帮助理解为什么这个函数 returns null
Need help understanding why this function returns null
我正在编写一个 Delphi Android 应用程序来使用 Google 推送。
这是有问题的功能。它总是 returns null:
var
PushService: TPushService;
Notifications: TArray<TPushServiceNotification>;
ServiceConnection: TPushServiceConnection;
begin
PushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.Gcm);
Memo1.Lines.Add('PushService');
if not assigned(PushService) then
Memo1.Lines.Add('PushService error')
else begin
Memo1.Lines.Add('PushService ok');
PushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '543546532983';
ServiceConnection := TPushServiceConnection.Create(PushService);
TPushService.TServiceNames.Gcm
(Google 云消息传递)已弃用,因为 Google 不再提供该服务。您需要改用 TPushService.TServiceNames.FCM
(Firebase 云消息传递)。
有关如何在您的应用中注册、配置和使用 FCM 的详细信息,请参阅 Embarcadero 文档中的 Firebase Android Support。
我正在编写一个 Delphi Android 应用程序来使用 Google 推送。
这是有问题的功能。它总是 returns null:
var
PushService: TPushService;
Notifications: TArray<TPushServiceNotification>;
ServiceConnection: TPushServiceConnection;
begin
PushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.Gcm);
Memo1.Lines.Add('PushService');
if not assigned(PushService) then
Memo1.Lines.Add('PushService error')
else begin
Memo1.Lines.Add('PushService ok');
PushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '543546532983';
ServiceConnection := TPushServiceConnection.Create(PushService);
TPushService.TServiceNames.Gcm
(Google 云消息传递)已弃用,因为 Google 不再提供该服务。您需要改用 TPushService.TServiceNames.FCM
(Firebase 云消息传递)。
有关如何在您的应用中注册、配置和使用 FCM 的详细信息,请参阅 Embarcadero 文档中的 Firebase Android Support。