我试过了:
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
正确显示,AdeviceToken
空白。
答案 0 :(得分:2)
因为:
APushService.AppProps[TPushService.TAppPropNames.GCMAppID] := '"mobilesdk_app_id"
错误,此属性与 mobilesdk_app_id 无关。它与 SENDER ID 相关。此值可在设置 - >下找到云消息 - >发件人ID 。一旦你输入了这个值,你就会收到令牌。