PICO Platform Unity SDK
PresenceService Class Reference

Static Public Member Functions

static Task< UserListGetInvitableUsers (InviteOptions options)
 Gets a list of invitable users for the current logged-in user. More...
 
static Task< ApplicationInviteListGetSentInvites ()
 Gets a list of invited users for the current logged-in user. You need set Presence before call this function. More...
 
static Task< ApplicationInviteListGetNextApplicationInviteListPage (ApplicationInviteList list)
 Get the next page of invited users. More...
 
static Task< SendInvitesResultSendInvites (string[] userIds)
 Invites specified user(s) to the current destination. More...
 
static Task Set (PresenceOptions options)
 Sets presence data for the current logged-in user. More...
 
static Task SetDestination (string apiName)
 Replaces the current logged-in user's destination with the provided one. More...
 
static Task SetIsJoinable (bool joinable)
 Sets whether the current logged-in user is joinable. More...
 
static Task SetLobbySession (string lobbySessionId)
 Replaces the current logged-in user's lobby session ID with the provided one. More...
 
static Task SetMatchSession (string matchSessionId)
 Replaces the current logged-in user's match session ID with the provided one. More...
 
static Task SetExtra (string extra)
 Sets extra presence data for the current logged-in user. More...
 
static Task Clear ()
 Clears presence data for the current logged-in user. More...
 
static Task< DestinationListGetDestinations ()
 Gets a list of destinations created on the PICO Developer Platform. More...
 
static Task< DestinationListGetNextDestinationListPage (DestinationList destinationList)
 Gets the next page of destinations. More...
 
static Task LaunchInvitePanel ()
 Launches the invite panel provided in the PICO Friends app. Users can invite other people on the panel. More...
 
static Task ShareVideoByImages (List< string > imagePaths)
 Shares a video made of images to Douyin (a video app in Mainland China). More...
 
static Task ShareVideo (string videoPath, string videoThumbPath)
 Shares a video to Douyin (a video app in Mainland China). More...
 
static void SetJoinIntentReceivedNotificationCallback (Message< PresenceJoinIntent >.Handler callback)
 

Member Function Documentation

◆ GetInvitableUsers()

static Task< UserList > GetInvitableUsers ( InviteOptions  options)
inlinestatic

Gets a list of invitable users for the current logged-in user.

Note
Currently, only invitable friends will be returned.
Parameters
optionsRestricts the scope of friends returned. If no user ID is passed, all friends will be returned. If specific user IDs are passed, the information about specified friends will be returned.
Returns
A list of friends that can be invited to the current destination.

◆ GetSentInvites()

static Task< ApplicationInviteList > GetSentInvites ( )
inlinestatic

Gets a list of invited users for the current logged-in user. You need set Presence before call this function.

Returns
A list of users that have been invited.

◆ GetNextApplicationInviteListPage()

static Task< ApplicationInviteList > GetNextApplicationInviteListPage ( ApplicationInviteList  list)
inlinestatic

Get the next page of invited users.

Parameters
listThe current page of invited users.
Returns
The next page of invited users.

◆ SendInvites()

static Task< SendInvitesResult > SendInvites ( string[]  userIds)
inlinestatic

Invites specified user(s) to the current destination.

Parameters
userIdsThe ID(s) of the user(s) to invite.

◆ Set()

static Task Set ( PresenceOptions  options)
inlinestatic

Sets presence data for the current logged-in user.

Parameters
optionsPresence-related options, including:
  • DestinationApiName: string, the API name of the destination.
  • IsJoinable: bool,
    • true: joinable
    • false: not joinable
  • LobbySessionId: string, a lobby session ID identifies a user group or team. Users with the same lobby session ID can play together or form a team in a game.
  • MatchSessionId: string, a match session ID identifies all users within a same destination, such as a map or a level. Users with different lobby session IDs will have the same match session ID when playing the same match.
  • Extra: string, extra presence data defined by the developer.

◆ SetDestination()

static Task SetDestination ( string  apiName)
inlinestatic

Replaces the current logged-in user's destination with the provided one.

Deprecated:
SetDestination can be replaced by Set()
Note
Other presence parameter settings will remain the same.
Parameters
apiNameThe API name of the new destination.

◆ SetIsJoinable()

static Task SetIsJoinable ( bool  joinable)
inlinestatic

Sets whether the current logged-in user is joinable.

Deprecated:
SetIsJoinable can be replaced by Set()
Note
Other presence parameter settings will remain the same. If the user's destination or session ID has not been set, the user cannot be set as joinable.
Parameters
joinableDefines whether the user is joinable:
  • true: joinable
  • false: not joinable

◆ SetLobbySession()

static Task SetLobbySession ( string  lobbySessionId)
inlinestatic

Replaces the current logged-in user's lobby session ID with the provided one.

Deprecated:
SetLobbySession can be replaced by Set()
Note
Other presence parameter settings will remain the same.
Parameters
lobbySessionIdThe new lobby session ID.

◆ SetMatchSession()

static Task SetMatchSession ( string  matchSessionId)
inlinestatic

Replaces the current logged-in user's match session ID with the provided one.

Deprecated:
SetMatchSession can be replaced by Set()
Note
Other presence parameter settings will remain the same.
Parameters
matchSessionIdThe new match session ID.

◆ SetExtra()

static Task SetExtra ( string  extra)
inlinestatic

Sets extra presence data for the current logged-in user.

Deprecated:
SetExtra can be replaced by Set()
Parameters
extraThe extra presence data, which is defined by the developer and will be returned in the user's presence information.

◆ Clear()

static Task Clear ( )
inlinestatic

Clears presence data for the current logged-in user.

Note
You need to clear a user's presence data when the user exits your app, leaves a specific destination within the app, or does not want others to see their destination and status.

◆ GetDestinations()

static Task< DestinationList > GetDestinations ( )
inlinestatic

Gets a list of destinations created on the PICO Developer Platform.

Returns
The list of destinations.

◆ GetNextDestinationListPage()

static Task< DestinationList > GetNextDestinationListPage ( DestinationList  destinationList)
inlinestatic

Gets the next page of destinations.

Parameters
destinationListThe current page of destinations.
Returns
The next page of destinations.

◆ LaunchInvitePanel()

static Task LaunchInvitePanel ( )
inlinestatic

Launches the invite panel provided in the PICO Friends app. Users can invite other people on the panel.

Note
Before calling this method, you should set presence data correctly.
Returns
Returns a message. Check Message.Error to see whether the panel has been successfully launched.

◆ ShareVideoByImages()

static Task ShareVideoByImages ( List< string >  imagePaths)
inlinestatic

Shares a video made of images to Douyin (a video app in Mainland China).

Note
Available in Mainland China only.
Parameters
imagePathsThe local path to images.
Returns
Returns a message. Check Message.Error to see whether the video has been successfully shared.

◆ ShareVideo()

static Task ShareVideo ( string  videoPath,
string  videoThumbPath 
)
inlinestatic

Shares a video to Douyin (a video app in Mainland China).

Note
Available in Mainland China only.
Parameters
videoPathThe local path to the video.
videoThumbPathThe local path to the video thumbnail. If not defined, the first frame of the video will become the thumbnail.
Returns
Returns a message. Check Message.Error to see whether the video has been successfully shared.

◆ SetJoinIntentReceivedNotificationCallback()

static void SetJoinIntentReceivedNotificationCallback ( Message< PresenceJoinIntent >.Handler  callback)
inlinestatic

When the user clicks on the invitation message, the system will launch your app and the callback will be triggered. Read the fields of Pico.Platform.Models.PresenceJoinIntent to figure out where the user wants to go. If the user is unable to go there, show the user the info about why they cannot go there.