Online Presence allows an app’s users to know which of their friends are currently online, what they are doing, and whether they are available to interact. See the example below that shows the Presence activity of friends on the Main Menu of the brainCloud Bombers.

Configs messaging service:

  • To make RTT Presence working, you need to enable RTT on the Design | Core App Info | Advanced Settings page first. Make sure the Real-time Tech (RTT) Enabled is checked.

  • Navigate to Design | Messaging | Presence Config page, enable presence service for your app by checking the first checkbox. Fill in all the required fields respectively. Click the Save button to complete your configuration.

Test:

  • Download the Unity test example from here. Unzip it and open it with Unity Hub.

  • Test from the editor as below or build it into any platform that fits your test device.

  • Logging your app from brainCloud setting tab:

  • Run the game, fill in the [User Name] and [Password] input fields with any words you prefer, and click Auth button, you will see the success return like below.

  • Click enableRTT button from your Unity app, you should see the return as below with RTT connect success info.

  • Go to brainCloud portal login to the same app as above, find page Design | Cloud Code | API Explorer, authenticate with a different user from above.

  • Select Presence Service and SysInitializePresence Operation, put the profileId of the current portal login user, and set the "activity" with "status": "waiting" as below:

  • Switch to Unity editor/app, paste the profiled which you got from the portal on the above step to profile id input box, then click the register Listener for profile: button. You will see the return as below with the presence listener registered success info. Check the activity and summaryFriendData of the portal user, these data will be changed later on.

  • Now, go back to brainCloud portal API Explorer page, select Presence Service and UpdateActivity Operation, set the "activity" with "status": "palying..." as below:

  • You should find your Unity editor/app incoming screen is auto refreshed with the new "status" of "activity" as "playing..." for the above portal user.

  • Now, let's change the "summaryFriendData" of current portal login user. Select PlayerState Service and UpdateSummaryFriendData Operation, set the "summaryFriendData" as below, hit Run.

  • Select Presence Service and ForcePush Operation, hit Run.

  • You should find this portal user's new "summaryFriendData" is auto refreshed on the screen of your Unity editor/app.

Did this answer your question?