GetPresenceOfFriends
Gets the presence data for the given platform
. Can be one of "all", "brainCloud", or "facebook". Will not include offline profiles unless includeOffline
is set to true.
Service | Operation |
---|---|
presence | GET_PRESENCE_OF_FRIENDS |
Method Parameters
Parameter | Description |
---|---|
platform | Gets a list of Presence entries for the specified platform or "all" for all platforms. |
includeOffline | Should offline users be included in the response? |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string platform = brainCloud;
bool includeOffline = true;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.PresenceService.GetPresenceOfFriends(platform, includeOffline, successCallback, failureCallback);
const char* platform = brainCloud;
bool includeOffline = true;
_bc->getPresenceService()->getPresenceOfFriends(platform, includeOffline, this);
NSString* platform = @brainCloud;
bool includeOffline = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc presenceService] getPresenceOfFriends:platform
includeOffline:includeOffline
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String platform = brainCloud;
boolean includeOffline = true;
this; // implements IServerCallback
_bc.getPresenceService().getPresenceOfFriends(platform, includeOffline, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var platform = brainCloud;
var includeOffline = true;
_bc.presence.getPresenceOfFriends(platform, includeOffline, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var platform = brainCloud;
var includeOffline = true;
ServerResponse result = await _bc.presenceService.getPresenceOfFriends(platform:platform, includeOffline:includeOffline);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var presenceProxy = bridge.getPresenceServiceProxy();
var platform = brainCloud;
var includeOffline = true;
var postResult = presenceProxy.getPresenceOfFriends(platform, includeOffline);
if (postResult.status == 200) {
// Success!
}
{
"service": "presence",
"operation": "GET_PRESENCE_OF_FRIENDS",
"data": {
"friendPlatform": "brainCloud",
"includeOffline": true
}
}
JSON Response
{
"data": {
"presence": [
{
"user": {
"id": <%= data.example.profileId %>,
"name": <%= data.example.playerName %>,
"pic": null,
"cxs": [
"22284:fb416888-e76d-425d-a06d-a5529bdba8d9:id58ohotujj893gomctos244al"
]
},
"online": true,
"summaryFriendData": {},
"activity": {
"LOCATION": "POKER_TABLE",
"STATUS": "PLAYING_GAME"
}
}
]
},
"status": 200
}