Extend ClientMainActivity with SDKGameActivity.
We need to override two function onCreateSdk(savedInstanceState: Bundle?) and getGameView(parentView: ViewGroup).
In onCreateSdk function, we need to call GameSdk.initialize.
In getGameView function, return the game screen showing the game.
WinZO game SDK uses GameCallbackListener to start and stop the game.
Example:
ClientMainActivity.kt
classClientMainActivity : SDKGameActivity() {overridefunonCreateSdk(savedInstanceState: Bundle?) {// initialize GameSDK GameSdk.initialize( context =this, clientAccessToken ="<your client access token>", isLiveApp =true, gameCallbackListener =object :GameCallbackListener {overridefungameConfig(gameConfig: String) { Log.v("gameTag", "gameConfig received by game") }overridefunstartGame() { Log.v("gameTag", "StartGame packet received by game") }overridefunstopGame() { Log.v("gameTag", "StopGame received by game") } }, gameName ="your game name", gameImageUrl ="game icon url" ) }// return view showing gamePlayoverridefungetGameView(parentView: ViewGroup): View {val gameView = LayoutInflater.from(this) .inflate(R.layout.activity_game_screen, parentView, false)return gameView }overridefunonDestroySdk() {// do any task on activity destroy }overridefunonActivityResultSdk(requestCode: Int, resultCode: Int, data: Intent?) {// do any task on activity result }}
You will get clientAccessToken from WinZO.
There are 2 options for handling matchmaking
Option 1: For matchmaking on your side. gameConfig object is:
// gameConfig received in GameCallbackListener{"winzoAccessToken":"my token","bootAmount":10,"bootId":"boot_10"}
Option 2: For matchmaking on WinZO's side. Opponent data and challenge Id are received in the game config object.
// gameConfig received in GameCallbackListener{"challengeId":"63a00f416b36ff003a71bd78","config": { .... //game-related data. },"playerInfo": {"winzoId":"12343342","name":"Rahul","profilePic":"https://d206uh8e4fpi1h.cloudfront.net/Limour.png" },"opponentsInfo": [ {"winzoId":"12342342","name":"KRISHNENDU2932","profilePic":"https://d206uh8e4fpi1h.cloudfront.net/Hippo.png" } ]}