GetPresenceOfUsers
Gets the presence data for the given profileIds
. Will not include offline profiles unless includeOffline
is set to true.
Service | Operation |
---|---|
presence | GET_PRESENCE_OF_USERS |
Method Parameters
Parameter | Description |
---|---|
profileIds | Gets a list of Presence for the specified profile ids. |
includeOffline | Should offline users be included in the response? |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string[] profileIds = { "aaa-bbb-ccc-ddd" };
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.GetPresenceOfUsers(profileIds, includeOffline, successCallback, failureCallback);
std::vector<std::string> profileIds;
profileIds.push_back("aaa-bbb-ccc-ddd");
bool includeOffline = true;
_bc->getPresenceService()->getPresenceOfUsers(profileIds, includeOffline, this);
NSArray* profileIds = [NSArray arrayWithObjects: @"aaa-bbb-ccc-ddd"];
bool includeOffline = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc presenceService] getPresenceOfUsers:profileIds
includeOffline:includeOffline
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String[] profileIds = new String[] { "aaa-bbb-ccc-ddd" };
boolean includeOffline = true;
this; // implements IServerCallback
_bc.getPresenceService().getPresenceOfUsers(profileIds, 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 profileIds = ["aaa-bbb-ccc-ddd"];
var includeOffline = true;
_bc.presence.getPresenceOfUsers(profileIds, includeOffline, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var profileIds = ["aaa-bbb-ccc-ddd"];
var includeOffline = true;
ServerResponse result = await _bc.presenceService.getPresenceOfUsers(profileIds:profileIds, includeOffline:includeOffline);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var profileIds = ["aaa-bbb-ccc-ddd"];
var includeOffline = true;
var postResult = presenceProxy.getPresenceOfUsers(profileIds, includeOffline);
if (postResult.status == 200) {
// Success!
}
{
"service": "presence",
"operation": "GET_PRESENCE_OF_USERS",
"data": {
"profileIds": [
"aaa-bbb-ccc-ddd",
"bbb-ccc-ddd-eee"
],
"includeOffline": true
}
}
JSON Response
{
"data": {
"presence": [
{
"user": {
"id": "aaa-bbb-ccc-ddd",
"name": "player1",
"pic": null,
"cxs": [
"22284:fb416888-e76d-425d-a06d-a5529bdba8d9:id58ohotujj893gomctos244al"
]
},
"online": true,
"summaryFriendData": {},
"activity": {
"LOCATION": "POKER_TABLE",
"STATUS": "PLAYING_GAME"
}
}
]
},
"status": 200
}