Represents the main way to interact with Skillz.
Aborts the Skillz match in the activity.
static void abortMatch(Activity activity)
Reference to the activity of your game's gameplay.
Updates the meta data for a Skillz match in progress.
static void addMetadataForMatchInProgress(java.util.Map<?,?> attributes, boolean isMatchInProgress)
Map containing the metadata of the match in progress.
A boolean indicating if a match is in progress.
Returns the current Skillz user's display name.
static java.lang.String currentUserDisplayName(Activity activity)
The instance of the Activity representing your game's gameplay.
A string representing the current user's display name.
Use this method to fetch the match information of the current match.
static MatchInfo getMatchInfo(Activity activity)
Returns a dictionary of gameplay parameters that you set in each match type in the Developer Console.
static java.util.Map<java.lang.String,java.lang.String> getMatchRules()
Map containing the gameplay parameters for the match.
Gets details of the currently logged in player.
static SkillzPlayer getPlayerDetails(Activity activity)
SkillzPlayer object that contains info of the currently logged in player.
Returns a random integer sequence supplied by the Skillz SDK to ensure fairness across competition games.
static SkillzRandom getRandom()
SkillzRandom object that wraps the random integer.
Returns whether or not there is currently a Skillz match in progress.
static boolean isMatchInProgress()
boolean indicating if a match is in progress.
Launches the Skillz UI.
static void launch(Activity activity)
Returns a more general Player object with more fields to describe a player.
static Player player(Activity activity)
An instance of the activity representing your game's gameplay.
Enables an app to receive push notifications.
static void registerPushToken(Context context, java.lang.String pushToken)
The current application's context to receive Skillz push notifications.
The device's Firebase push token.
Validate match id then reports a score to Skillz from a given activity.
static void reportScore(@NonNull final Activity activity, java.math.BigDecimal score, String matchId)
The activity to report the score from.
The score to report.
The id of the current match.
Returns the name of the Skillz SDK Version.
static java.lang.String SDKVersionShort()
The SDK Version as a string.
This method must be called each time the current player's score changes during a Skillz match.
static void updatePlayersCurrentScore(Activity activity, BigDecimal score, String matchId)
The activity which contains the score to update.
The player's updated score.
The id of the current match.
This class has methods to register an implementation of the
SyncDelegate interface to support synchronous matches.
Call this method to register your delegate object that implements the SyncDelegate Interface.
static void registerSyncDelegate(SyncDelegate delegate, Activity activity) ;
The object that implements the callback methods to support synchronous play.
The activity of your game.
Returns whether or not another the connected client to this match has called either
initiateSynchronousAbortWithCompletion: to end the match.
static boolean isMatchCompleted();
A boolean indicating whether or not the match has been completed.
Call this method in order to send a message to all clients connected to this match. This will trigger
didReceiveData: on all clients connected to the current match.
Note: NSData passed to this function are limited to a certain size based on the game, and this function will assert if over that size. (2048 bytes currently).
static void sendData(@NonNull byte data);
The message to be sent.
Use this method to query the number of players currently connected to a match.
static int getConnectedPlayerCount();
The numbers of players connected.
Returns the opponent user's player ID for an in progress match. You can use this to fetch the opponent
SKZSyncPlayer, or for variable passing.
static long getOpponentPlayerId();
An integer identifying the opponent user in the match.
Returns the current user's player ID for an in progress match. You can use this to fetch the current SKZSyncPlayer, or for variable passing.
static long getCurrentPlayerId();
An integer identifying the current user in the match.
Returns the current server time so that you may synchronize via that rather than local device time.
Note: Not to be used for displaying the current date/time.
static double getServerTime();
The current time in seconds.
A Skillz player only has this much time remaining to reconnect once disconnected, and is the actual time they have left when this method is called. Reconnect time is strictly decreasing and does not reset after successful connections to prevent griefing.
Note: If the value returned is negative, the player should be considered aborted from the match.
static long getTimeLeftForReconnection(long playerId);
The player id of the disconnected player.
The current time in milliseconds.
Implement this interface and register it with
SkillzSync to support synchronous matches.
This method will be called when the opponent player has lost their connection. This method is not called when the game is finished nor when the opponent aborts the match.
You could, for example, use this routine to pause the match until the disconnected player is either reconnected or kicked if they don't reconnect within the allotted time.
void onOpponentHasLostConnection(long playerId);
The id of player who is attempting to reconnect. The long type is equivalent to
This method is called when a disconnected opposing player reconnects to the server within the allotted time.
Note: This method is also called the first time the current player successfully connects to the server.
You can use this method to resume play in a game that had been paused when the player disconnected.
void onOpponentHasReconnected(long playerId);
The id of player who has reconnected. The long type is equivalent to
This method is called when the opposing player disconnects from the server and does not reconnect within the allotted time. This will remove them from the match.
You should implement this method to halt the game and report the current player's score.
void onOpponentHasLeftMatch(long playerId);
The id of player who has permanently left the match. The long type is equivalent to
This method will be called when the current player has lost their connection to the Skillz Server.
Note that the SDK will try to reestablish a connection to the server on its own, there is no specific action the game needs to perform in this situation.
onOpponentHasReconnected except it is the current player who has reconnected to server.
This method is called when the current player disconnects from the server and does not reconnect within the allotted time. This will remove them from the match.
The current player is permanently removed from the match, in much the same manner as if they had aborted the match.
Note: You should implement this method and abort the current player from the match.
This method receives an array of data that had been sent by the other player.
void onDidReceiveData(@NonNull byte data);
data The message sent by the other player.
This method will be triggered on all clients when one client has explicitly reported a score or aborted.