Skip to content

CartySdk Integration

Requirements

  • Android Studio Giraffe+
  • Gradle 7+, minSdk 21

Dependency

groovy

dependencies {
    implementation "io.carty.bidad:carty-sdk:+"
}

Permission

xml

<uses-permission android:name="android.permission.INTERNET" /><!-- necessary -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><!-- optional -->
<uses-permission android:name="com.google.android.gms.permission.AD_ID" /><!-- optional -->

Init

It is recommended that developers call this in the onCreate method of the Application.

  • Java
java

CTAdConfig adConfig = new CTAdConfig.Builder()
        .setAppId("YOUR_APP_ID")// [necessary] appid from carry publisher
        .setChannel("YOUR_APP_CHANNEL")// [optional] your app channel
        .setDebug(BuildConfig.DEBUG)// [optional] setting "true" will print debug logs
        .build();

CTAdSdk.init(applicationContext, adConfig, new CTAdSdk.CTInitListener() {
    @Override
    public void onInitSuccess() {
    }

    @Override
    public void onInitFailed(CTAdError adError) {
    }
});
  • Kotlin
kotlin

val adConfig = CTAdConfig.Builder()
    .setAppId("YOUR_APP_ID")// [necessary] appid from carty publisher
    .setChannel("YOUR_APP_CHANNEL")// [optional] your app channel
    .setDebug(BuildConfig.DEBUG)// [optional] setting "true" will print debug logs
    .build()
CTAdSdk.init(this, adConfig, object : CTAdSdk.CTInitListener {
    override fun onInitSuccess() {
    }
    override fun onInitFailed(adError: CTAdError) {
    }
})

Global Setting

It is recommended to call this function before sdk initialization.

  • Java
java

// Whether to open the landing page using the system browser, sdk default value is true
CTGlobalSettings.getInstance().setSystemBrowser(true);
  • Kotlin
kotlin

// Whether to open the landing page using the system browser, sdk default value is true
CTGlobalSettings.getInstance().isSystemBrowser = true

Examples on GitHub

CartySDKAndroid