How to Handle Match Start

Update your GameActivity’s onCreate method and onDestroy method to handle game set-up & clean-up.


SKZMatchInfo matchInfo is a data structure that contains information about the current match and the player in it. The data contained within can be used to display information to players or to power external analytics. Make sure to check if the match is synchronous before registering the SyncDelegate. You can use the IsSynchronous boolean in the Skillz.getMatchInfo() object to determine whether the match is synchronous or asynchronous. (You can also fetch this object directly from the Skillz API).


public class GameActivity extends SkillzActivity {
    public void onCreate(Bundle savedInstanceState) {

       MatchInfo matchInfo = Skillz.getMatchInfo(this);
       if (matchInfo != null && matchInfo.isSynchronous()) {
          // handle sync match
          SkillzSync.registerSyncDelegate(this, this);
       } else {
          // handle async match

onDestroy (optional)

The onDestroy method is called when the Skillz portal is exited; it should be used to load the menu state of your game. 

Make sure to handle any necessary clean up of static state or listeners.

The SyncDelegate will automatically be cleaned up when a score is reported or the match is aborted.


Next Step: Send and Receive Data