Use the Samsung CloudDev SDK
The Samsung CloudDev SDK provides the following capabilities:
- Determine if the app is running in a cloud environment.
- Request the Google Advertising Identifier (GAID).
- Determine the type of account used to log in to the game.
Check the execution environment
Use isCloudEnvironment to return a boolean value that allows you to determine if your app is being run in a cloud environment.
public static boolean isCloudEnvironment(Context context)
boolean isCloudEnv = CloudDevSdk.isCloudEnvironment(context);
log("isCloudEnvironment: " + isCloudEnv);
Request the GAID
Request the Google Advertising Identifier (GAID) using the kinds
paramenter and receive the result through CloudDevCallback.
If the response is successful, the callback returns a map with the keys that correspond to the requested strings in the kinds
parameter.
public static void request(Context context, List<String> kinds, CloudDevCallback callback)
CloudDevSdk.request(context, Arrays.asList("gaid"), new CloudDevCallback() {
@Override
public void onSuccess(Map<String, String> kinds) {
// This is called in IO thread
log("Google Advertising ID: " + kinds.getOrDefault("gaid", ""));
}
@Override
public void onError(String reason) {
// This is called in IO thread
log("Error: " + reason);
}
});
kinds (string) | Description |
---|---|
gaid | Google Advertising ID of the user's local device. |
Determine user account type
Determine if the user has the specified account type on their device (with saved user/game data) that they use to log in to the game.
If the response is successful, the callback returns a map with the keys that correspond to the requested strings in the kinds
parameter.
Each set contains a key as one of the kinds
parameter and a value to determine if the result is successful or not. When successful, the value is "true"
. When not successful, the value is "false"
.
public static void send(Context context, Map<String, String> data, CloudDevCallback callback)
Map<String, String> data = new HashMap<String, String>();
data.put("login_account_type", "guest");
CloudDevSdk.send(context, data, new CloudDevCallback() {
@Override
public void onSuccess(Map<String, String> kinds) {
// This is called in IO thread
log("Login Account Type Send Result: " + kinds.getOrDefault("login_account_type", ""));
}
@Override
public void onError(String reason) {
// This is called in IO thread
log("Error: " + reason);
}
});
kinds (string) | Value (string) | Description |
login_account_type |
| The type of account used by the user to log in to the game. |