Use the Samsung CloudDev SDK

The Samsung CloudDev SDK provides the following capabilities:

  1. Determine if the app is running in a cloud environment.
  2. Request the Google Advertising Identifier (GAID).
  3. 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.

[ Javascript ]

public static boolean isCloudEnvironment(Context context)

boolean isCloudEnv = CloudDevSdk.isCloudEnvironment(context);
log("isCloudEnvironment: " + isCloudEnv);

[ Kotlin ]

val 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.

Only one request/send function can be processed simultaneously for each tag value. tag value is used as an identifier and can be any value. (Do not use tag value as "dev") It is recommended to use category("game", "mmp") or service name("clouddev") for tag value.

If the response is successful, the callback returns a map with the keys that correspond to the requested strings in the kinds parameter.

[ Javascript ]

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);
    }
});

[ Kotlin ]

// Do not use `TAG` value as "dev"
CloudDevSdk.request(context, TAG, listOf("gaid"), object : CloudDevCallback {
    override fun onSuccess(tag: String, kinds: Map<String, String>) {
        // This is called in IO thread
        if (tag == TAG) {
            val gaid = kinds.getOrDefault("gaid", "")
            log("Google Advertising ID: $gaid")
        }
    }
    override fun onError(tag: String, reason: String) {
        // This is called in IO thread
        if (tag == TAG) {
            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.

Only one request/send function can be processed simultaneously for each tag value. tag value is used as an identifier and can be any value. (Do not use tag value as "dev") It is recommended to use category("game", "mmp") or service name("clouddev") for tag value.

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" .

[ Javascript ]

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);
    }
});

[ Kotlin ]

val data = mapOf("login_account_type" to "guest")

// Do not use `TAG` value as "dev"
CloudDevSdk.send(context, TAG, data, object : CloudDevCallback {
    override fun onSuccess(tag: String, kinds: Map<String, String>) {
        // This is called in IO thread
        if (tag == TAG) {
            val accountType = kinds.getOrDefault("login_account_type", "")
            log("Login Account Type : $accountType")
        }
    }
    override fun onError(tag: String, reason: String) {
        // This is called in IO thread
        if (tag == TAG) {
            log("Error: $reason")
        }
    }
})
kinds (string)

Value (string)

Description

login_account_type

  • guest
  • samsung
The type of account used by the user to log in to the game.