Initialize Social APIs #

Before you can use the client Friend and Presence APIs for Unreal or Unity, you must initialize the services by calling the Initialize() methods. This step will synchronize friend/presence information between the player client and the Pragma backend so that newly created sessions can correctly determine the player’s backend state.

Initialize() can only be called after login. Upon logout, the service is un-initialized and the On* action-handlers are unbound. You must call initialize() on the service when you log back in.

Initialize Friend and Presence APIs #

Player->FriendApi().Initialize(
  const FOnCompleteDelegate& OnComplete
);
Player.FriendApi.Initialize(
  CompleteDelegate onComplete
);

The FriendApi.Initialize() method triggers the OnChanged events, providing you with a list of friends and invites. If a presence exists on the backend, the cache is updated and the OnPresenceChanged event fires.

After you receive a successful response, you can begin using the Friend and Presence APIs.

Force sync #

While the Pragma APIs constantly attempt to stay in sync with the Pragma Engine backend, there may be instances where you want to explicitly force the friends or presence cache to sync with the backend data. To forcibly synchronize the client’s state with the platform, call the ForceSync() methods:

Player->FriendApi().ForceSync(
  const FOnCompleteDelegate& OnComplete
);

Player->PresenceApi().ForceSync(
  const FOnCompleteDelegate& OnComplete
);
player.FriendApi.ForceSync(
   CompleteDelegate onComplete
);

player.PresenceApi.ForceSync(
   CompleteDelegate onComplete
);

Related events:

Related errors: