C API Reference
Studio SDK’s C API is declared in GameBench.h
and is implemented by GameBench.aar
on Android and GameBench.framework
on iOS. These files are found in the GameBench Studio SDK .zip. Please see the Integration Guide for adding these files to your project.
The C API is contained by the IGameBench
interface (i.e. a struct containing function pointers), which is obtainable through the global helper function getGameBench()
. The APIs that follow are all members of this interface.
Sessions
int sessionStart(const char* title)
Starts a new capture session, with an optional title.
int sessionStop()
Stops the current capture session.
int upload(GameBenchUploadCallback callback, void* callbackToken)
Uploads any outstanding sessions to the endpoint configured in the UI. After successful upload the session data will be removed from the device. Must be called without an active session.
NB: The callback is a nullable pointer to a function with the signature void (*)(void*, int, const char*)
. The first parameter corresponds to whatever you passed as the callbackToken
parameter.
int (*sessionGetId)(char* uuidbuf, int buflen);
Copies the UUID of the active session to the buffer pointer to by uuidbuf
. Useful for when you want find session data on the server.
Markers
To isolate specific areas of gameplay such as levels or battles, GameBench provides markers functionality. For example, to isolate performance data during a particular game level, you can call markerStart()
when the level begins and markerStop()
when the level is completed.
void markerStart(const char* name, const char* group)
Record a ‘start’ marker with the given name and marker group (optional).
void markerStop(const char* name, const char* group)
Record a ‘stop’ marker with the given name.
void markLaunchComplete()
Record a ’launch complete’ marker that has special significance in the web dashboard.
Tags
void setTag(const char* name, const char* value)
Set a tag in the tags collection. Passing a value of null will remove it.
Configuration
void setStringConfigItem(const char* name, const char* value);
void setIntConfigItem(const char* name, int value);
See the Configuration section for the full list of configurable items.
Note that these values set in code are transient and do not persist beyond process exit.