SysInitializePresence
tip
This method is available in Cloud Code scripts only.
Creates or updates the presence of profileId. visible is optional (defaults to true). activity is optional. expirySecs is optional (defaults to brainCloud property presPxExpirySecs). If activity is included, the same restrictions apply as those outlined in UpdateActivity.
| Service | Operation |
|---|---|
| presence | SYS_INITIALIZE_PRESENCE |
Method Parameters
| Parameter | Description |
|---|---|
| profileId | Target profile ID. |
| visible | Should user appear in presence? True by default. |
| activity | Presence activity record json. |
| expirySecs | Time before this activity record expires. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var presenceProxy = bridge.getPresenceServiceProxy();
var profileId = "aaa-bbb-ccc-ddd";
var activity = { "LOCATION": "POKER_TABLE", "STATUS": "PLAYING_GAME" };
var visible = true;
var expirySecs = 300;
var postResult = presenceProxy.sysInitializePresence(profileId, activity, visible, expirySecs);
if (postResult.status == 200) {
// Success!
}
{
"service": "presence",
"operation": "SYS_INITIALIZE_PRESENCE",
"data": {
"profileId": "aaa-bbb-ccc-ddd",
"visible": true,
"activity": {},
"expirySecs": 300
}
}
JSON Response
{
"data": null,
"status": 200
}