Integrating SDK

1.) Add the following dependency in your app-level build.gradle file :

dependencies {
    ...
    implementation "com.winzo.winzo-sdk:winzo-sdk:1.0.3"
}

2.) Add the following dependency in your project-level build.gradle file :

dependencies {
    ...
    classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.3'
}

allprojects {
    repositories {
        ...
        maven {
            url "https://artifactory-prd.winzo.io/artifactory/winzo-sdk/"
            credentials {
                username = "********"
                password = "********"
            }
        }
    }
}

you will receive the username and password separately

3.) Add MainActivity to manifest file and the intent filters for launching MainActivity, Remove remaining intent filters for remaining launcher an activity.

<activity
    android:name="com.base.aidllib.MainActivity"
    android:exported="true"
    android:theme="@style/SplashTheme">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
        <action android:name="com.base.aidllib.MainActivity" />
    </intent-filter>
</activity>

4.) Extend AppApplication with WinzoApplication, register your activity with WinZO activity. Set the game icon by using WinzoSdk.setGameIcon method. Set product flavor by using WinzoSdk.setProductFlavor method.

class ClientApplication : WinzoApplication() {
    override fun onCreate() {
        super.onCreate()
        WinzoSdk.registerActivity(ClientActivity::class.java)
        WinzoSdk.setGameIcon(this.getDrawable(R.drawable.your_game_icon))
        if (BuildConfig.is_live) {
            WinzoSdk.setProductFlavor(ProductFlavor.LIVE)
        } else {
            WinzoSdk.setProductFlavor(ProductFlavor.STAG)
        }
    }
}

5.) You will receive the listed values in intent in registered activity (the activity you have registered with WinzoSdk.registerActivity(ClientActivity::class.java))

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        val winzoAccessToken = intent.getStringExtra(Constants.WINZO_ACCESS_TOKEN)
        val joinCode = intent.getStringExtra(Constants.JOIN_CODE)
        val bootAmount = intent.getFloatExtra(Constants.BOOT_AMOUNT, 0f)
        val bootId = intent.getStringExtra(Constants.BOOT_ID)
        ...
}
  • joinCode, bootAmount, bootId can be null

  • winzoAccessToken will be used in API calls.

  • if bootAmount and bootIdis null then show the main landing screen otherwise start the game with these values

6.) Finally, add the application class to the manifest file

<application
    android:name=".ClientApplication"
    ...
    />

Adaptive App Icon

  • Create Adaptive App Launcher Icon in mipmap directory with the name of ic_launcher (which is the default).

  • The foreground Layer name should be ic_launcher_foreground

  • The Background Layer name should be ic_launcher_background

Last updated