Reputation: 99
I have tried:
APushService := TPushServiceManager.Instance.GetServiceByName(TPushService.TServiceNames.GCM);
APushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '"mobilesdk_app_id" '; // my "mobilesdk_app_id" from google-services.json
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];
ADeviceID
comes up correctly, by AdeviceToken
comes up blank.
Upvotes: 0
Views: 1423
Reputation: 571
it's because:
APushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '"mobilesdk_app_id"
is wrong and this property does not relate to the mobilesdk_app_id. It's related to the SENDER ID. This value can be found under settings -> cloud messaging -> sender Id. Once you put this value, you will receive the token.
Upvotes: 2