API Reference
Core Loop​
Launch Skillz UI​
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
This method is overloaded
- Asynchronous
- Synchronous
void SkillzCrossPlatform.LaunchSkillz();
Legacy:
void SkillzCrossPlatform.LaunchSkillz(SkillzMatchDelegate matchDelegate);
Parameters​
Legacy: matchDelegate
A reference to a SkillzMatchDelegate instance that Skillz will use
void SkillzCrossPlatform.LaunchSkillz();
Legacy:
void SkillzCrossPlatform.LaunchSkillz(SkillzMatchDelegate matchDelegate);
Parameters​
Legacy: matchDelegate
A reference to a SkillzMatchDelegate instance that Skillz will use
func initWithGameId(
gameId: String,
forDelegate: SkillzBaseDelegate,
withEnvironment: SkillzEnvironment,
allowExit: Bool)
Parameters​
gameId
The ID string of your game that is created from the Skillz Developer Console
forDelegate
Reference to a SkillzDelegate instance
withEnvironment
The Skillz server environment your game will run in. It can be either SkillzSandbox or SkillzProduction
allowExit
Specifies if the user can exit the Skillz UI via the sidebar menu
- (void)initWithGameId:(NSString *)
forDelegate:(<SkillzBaseDelegate>)
withEnvironment:(SkillzEnvironment)
allowExit:(BOOL)
Parameters​
initWithGameId
The ID string of your game that is created from the Skillz Developer Console
forDelegate
Reference to a SkillzDelegate instance
withEnvironment
The Skillz server environment your game will run in. It can be either SkillzSandbox or SkillzProduction
allowExit
Specifies if the user can exit the Skillz UI via the sidebar menu. This can be either YES or NO
void Skillz.launch(Activity activity)
Update Current Score​
Call this method every time the player's score changes during a Skillz match.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
This method is overloaded
- string
- int
- float
void SkillzCrossPlatform.UpdatePlayersCurrentScore(string score);
Parameters​
score
The player's current score as a string
void SkillzCrossPlatform.UpdatePlayersCurrentScore(int score);
Parameters​
score
The player's current score as an integer
void SkillzCrossPlatform.UpdatePlayersCurrentScore(float score);
Parameters​
score
The player's current score as a float
This method is overloaded
- without Match ID
- with Match ID
func updatePlayersCurrentScore(currentScoreForPlayer: NSNumber)
Parameters​
currentScoreForPlayer
The players current score as NSNumber
func updatePlayersCurrentScore(
currentScoreForPlayer: NSNumber,
withMatchId: NSNumber)
Parameters​
currentScoreForPlayer
The players current score as NSNumber
withMatchId
The match ID as NSNumber
This method is overloaded
- without Match ID
- with Match ID
- (void)updatePlayersCurrentScore: (NSNumber *)
Parameters​
updatePlayersCurrentScore
The players current score as an NSNumber
- (void)updatePlayersCurrentScore: (NSNumber *)
withMatchId: (NSNumber *)
Parameters​
updatePlayersCurrentScore
The players current score as NSNumber
withMatchId
The match ID as NSNumber
void updatePlayersCurrentScore(Activity activity, BigDecimal score, String matchId)
Parameters​
activity
Current activity context
score
Player's updated score
matchId
ID of the current match
Submit Score​
Call this method when a player finishes a match. This will send the score to Skillz and conclude the match. This will not send the user back to the Skillz UI.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
This method is overloaded
- string
- int
- float
void SkillzCrossPlatform.SubmitScore(string score, Action successCallback, Action<string> failureCallback)
Parameters​
score
Player's final score as a string
successCallback
Implementation of the System.Action delegate that handles successful submission
failureCallback
Implementation of the System.Action delegate that handles failed submission
void SkillzCrossPlatform.SubmitScore(int score, Action successCallback, Action<string> failureCallback)
Parameters​
score
Player's final score as an integer
successCallback
Implementation of the System.Action delegate that handles successful submission
failureCallback
Implementation of the System.Action delegate that handles failed submission
void SkillzCrossPlatform.SubmitScore(float score, Action successCallback, Action<string> failureCallback)
Parameters​
score
Player's final score as a float
successCallback
Implementation of the System.Action delegate that handles successful submission
failureCallback
Implementation of the System.Action delegate that handles failed submission
func submitScore(score: NSNumber,
withSuccess: () -> Void,
withFailure: (String) -> Void)
Parameters​
score
The score for the match
withSuccess
Success completion block
withFailure
Failure completion block, returns string error message
- (void)submitScore: (NSNumber *)
withSuccess: ^(void)
withFailure: ^(NSString *) errorMessage
Parameters​
submitScore
The score for the match
withSuccess
Success completion block
withFailure
Failure completion block, returns string error message
void Skillz.submitScore(@NonNull final Activity activity, BigDecimal score, String matchId, SkillzScoreCallback callback)
Parameters​
activity
The activity to report the score from
score
Score to report in BigDecimal
matchId
ID of the current match
callback
SkillzScoreCallback that is called upon completion
End Replay​
End the current replay if one exists and returns the status of the score submission. Must be called after score has been submitted. Use to end replay recording at conclusion of the match and before user is presented with personalized progression room metrics.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
bool EndReplay()
Returns​
Boolean true if end replay was successful, false if the user has not submitted a score for the match
func endReplayRecording() -> Bool
Returns​
Boolean true if end replay was successful and false if the user has not submitted a score for the match
- (BOOL)endReplayRecording
Returns​
Boolean true if end replay was successful and false if the user has not submitted a score for the match
Return to Skillz​
The ReturnToSkillz method presents the Skillz UI. This must be called after the score has been submitted with the SubmitScore method. After the SubmitScore has been called you can present users with relevant statistics such as high score and present content to enhance the game experience.
In all cases, it will return a boolean, indicating whether or not it is able to return the user to Skillz. For the case of a match in progress, unless a score has been submitted, this method will return false and the user will not be returned to Skillz. If a score has been submitted, it returns true and returns the user to Skillz.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
bool SkillzCrossPlatform.ReturnToSkillz()
Returns​
Boolean indicating whether it is able to return the user to Skillz UI
func returnToSkillzWithCompletion(completion: () -> Void) -> BOOL
Parameters​
completion
Completion block
Returns​
Boolean indicating whether it is able to return the user to Skillz UI
- (BOOL)returnToSkillzWithCompletion:^(void)
Parameters​
returnToSkillzWithCompletion
Completion block
Returns​
Boolean indicating whether it is able to return the user to Skillz UI
boolean Skillz.returnToSkillz(@NonNull final Activity activity, String matchId)
Parameters​
activity
Current activity context
matchId
ID of the match just being played, send null if not in a match
Abort Match​
Forfeits the current match and returns to the Skillz UI.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.AbortMatch()
This method is overloaded
- without Match ID
- with Match ID
- bot match
func notifyPlayerAbort(completion: () -> Void)
Parameters​
completion
Callback to invoke after the method has completed execution
func notifyPlayerAbort(withMatchId: NSNumber,
withCompletion: () -> Void)
Parameters​
withMatchId
Match ID as NSNumber
withCompletion
Callback to invoke after the method has completed execution
func notifyPlayerAbortForBotMatch(withBotScore: NSNumber?,
completion: () -> Void)
Parameters​
withBotScore
Bot score as NSNumber
completion
Callback to invoke after the method has completed execution
This method is overloaded
- without Match ID
- with Match ID
- bot match
- (void)notifyPlayerAbortWithCompletion: ^(void)
Parameters​
notifyPlayerAbortWithCompletion
Completion block
- (void)notifyPlayerAbortWithMatchId: (NSNumber *)
WithCompletion: ^(void)
Parameters​
notifyPlayerAbortWithMatchId
Match ID as NSNumber
WithCompletion
Completion block
- (void)notifyPlayerAbortForBotMatchWithBotScore:(NSNumber * _Nullable)
completion:^(void)
Parameters​
notifyPlayerAbortForBotMatchWithBotScore
Bot score as NSNumber
completion
Completion block
void Skillz.abortMatch(Activity activity)
Display Tournament Results With Score​
The DisplayTournamentResultsWithScore method replaces the deprecated ReportFinalScore method. Skillz recommends that you try to use the SubmitScore and ReturnToSkillz methods. However, DisplayTournamentResultsWithScore can be used as a failsafe if the SubmitScore method fails.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
This method is overloaded
- string
- int
- float
void SkillzCrossPlatform.DisplayTournamentResultsWithScore(string score)
Parameters​
score
Player's final score as a string
void SkillzCrossPlatform.DisplayTournamentResultsWithScore(int score)
Parameters​
score
Player's final score as an integer
void SkillzCrossPlatform.DisplayTournamentResultsWithScore(float score)
Parameters​
score
Player's final score as a float
This method is overloaded
- without Match ID
- with Match ID
- bot match
func displayTournamentResults(withScore: NSNumber,
withCompletion: () -> Void)
Parameters​
withScore
NSNumber score value
withCompletion
Completion block
func displayTournamentResults(withScore: NSNumber,
withMatchId: NSNumber,
withCompletion: () -> Void)
Parameters​
withScore
Player score as NSNumber
withMatchId
Match ID as NSNumber
withCompletion
Completion block
func displayResultsForBotMatch(withPlayerScore: NSNumber,
botScore: NSNumber,
withCompletion: () -> Void)
Parameters​
withPlayerScore
Player score as NSNumber
botScore
Bot score as NSNumber
withCompletion
Completion block
This method is overloaded
- without Match ID
- with Match ID
- bot match
- (void)displayTournamentResultsWithScore: (NSNumber *)
withCompletion: ^(void))
Parameters​
displayTournamentResultsWithScore
Player score as NSNumber
WithCompletion
Completion block
- (void)displayTournamentResultsWithScore: (NSNumber *)
withMatchId: (NSNumber *)
withCompletion: ^(void))
Parameters​
displayTournamentResultsWithScore
Player score as NSNumber
withMatchId
Match ID as NSNumber
WithCompletion
Completion block
- (void)displayResultsForBotMatchWithPlayerScore: (NSNumber *)
botScore: (NSNumber *)
withCompletion: ^(void))
Parameters​
displayResultsForBotMatchWithPlayerScore
Player score as NSNumber
botScore
Bot score as NSNumber
WithCompletion
Completion block
void Skillz.displayTournamentResultsWithScore(@NonNull final Activity activity, BigDecimal score, String matchId)
Parameters​
activity
Current activity context
score
The score to report in BigDecimal
matchId
The id of the current match
Audio API​
Get SFX Volume​
Gets the volume for sound effects in your game.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
Set SFX Volume​
Sets the volume for the sound effects in your game.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.setSFXVolume(float volume)
Parameters​
volume
A float between 0 and 1, inclusive
Get Background Music Volume​
Gets the volume for the background music that is played in the Skillz UI.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
Set Background Music Volume​
Sets the volume of the background music that plays in the Skillz UI.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.setSkillzMusicVolume(float volume)
Parameters​
volume
A float between 0 and 1, inclusive
func backgroundMusicVolume(volumeLevel: GCFloat)
Parameters​
musicVolume
GCFloat between 0 and 1, inclusive
- (void)setBackgroundMusicVolume: (GCFloat)
Parameters​
setBackgroundMusicVolume
GCFloat between 0 and 1, inclusive
void SkillzAudio.setSkillzMusicVolume(float volume)
Parameters​
volume
float between 0 and 1, inclusive
Set Background Music​
Specifies the music file to play as background music while in the Skillz UI.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.setSkillzBackgroundMusic(string fileName)
Parameters​
fileName
Path to the music file to play in the background of the Skillz UI
func setBackgroundMusicFile(fileName: String) -> BOOL
Parameters​
fileName
Path the music file to play in the background of the Skillz UI
Returns​
Boolean indicating whether pathname passed validation
- (BOOL)setBackgroundMusicFile: (NSString*)
Parameters​
setBackgroundMusicFile
Music file to play in the background of the Skillz UI
Returns​
Boolean indicating whether pathname passed validation
This method is overloaded
- file
- resource ID
Progression API​
Progression Namespace Constants​
Calls to the progression methods must use one of the three namespace string values. Each namespace returns a separate list of key-value pairs for that namespace:
DefaultPlayerDataFor read-only Skillz player data and is game-specific.PlayerDataFor publisher-defined player data and is game-specific.InGameItemsFor publisher-defined player data and is shared across all games in publisher's portfolio.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
ProgressionNamespace.DEFAULT_PLAYER_DATA
ProgressionNamespace.PLAYER_DATA
ProgressionNamespace.IN_GAME_ITEMS
ProgressionNamespaceDefaultPlayerData
ProgressionNamespacePlayerData
ProgressionNamespaceInGameItems
ProgressionNamespaceDefaultPlayerData
ProgressionNamespacePlayerData
ProgressionNamespaceInGameItems
ProgressionNamespace.DefaultPlayerData
ProgressionNamespace.PlayerData
ProgressionNamespace.InGameItems
Get Progression User Data​
Retrieve data for the current user. This method requires callback methods that allow you to handle success and fail scenarios.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.GetProgressionUserData(string progressionNamespace, List<string> userDataKeys, Action<Dictionary<string, ProgressionValue>> successCallback, Action<string> failureCallback)
Parameters​
progressionNamespace
One of the namespace String constants
userDataKeys
String key list of desired fields.
successCallback
Action delegate to handle successful callback. The method must be defined in the implementation.
failureCallback
Action delegate to handle failed callback. The method must be defined in the implementation.
func getUserData(forNamespace: String!,
withKeys: NSMutableArray!,
withSuccess: ([AnyHashable : Any]?) -> Void,
withFailure: (String?) -> Void)
forNamespace
One of the String constants
withKeys
NSMutableArray of desired field key Strings
withSuccess
Function to handle callback success and AnyHashable return data object
withFailure
Function to handle callback failure and String error message
- (void)getUserDataForNamespace: (NSString *)
withKeys: (NSMutableArray *)
withSuccess: ^(NSDictionary *userData)
withFailure: ^(NSString *error)
Parameters​
getUserDataForNamespace
One of the NSString constants
withKeys
String key NSMutableArray of desired fields
withSuccess
Function to handle callback success and NSDictionary return data object
withFailure
Function to handle callback failure and NSString error message
void SkillzProgression.getUserData(String namespace, List<String> userDataKeys, ProgressionCallback callback)
Parameters​
namespace
One of the namespace String constants
userDataKeys
String key list of desired fields.
callback
ProgressionCallback object to handle callback success or failure. Must be defined in implementation.
Update Progression User Data​
Write data for the current user. This method requires callback methods that allow you to handle success and fail scenarios. Can update up to 25 elements per call.
Note​
The DefaultPlayerData namespace is read-only, and cannot be used with this method.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.UpdateProgressionUserData(string progressionNamespace, Dictionary<string, object> userDataUpdates, Action successCallback, Action<string> failureCallback)
Parameters​
progressionNamespace
One of the namespace String constants
userDataUpdates
Dictionary of key/value pairs to be updated
successCallback
Action delegate to handle successful callback. The method must be defined in the implementation
failureCallback
Action delegate to handle failed callback. The method must be defined in the implementation
func updateUserData(forNamespace: String!,
withUserData: [AnyHashable : Any]!,
withSuccess: ([AnyHashable : Any]?) -> Void,
withFailure: (String?) -> Void)
Parameters​
forNamespace
One of the String constants
withUserData
AnyHashable of key/value pairs to be updated
withSuccess
Function to handle callback success and AnyHashable return data object
withFailure
Function to handle callback failure and String error message
- (void)updateUserDataForNamespace: (NSString *)
withUserData: (NSDictionary *)
withSuccess: ^(NSDictionary *userData)
withFailure: ^(NSString *error)
Parameters​
updateUserDataForNamespace
One of the NSString constants
withUserData
Dictionary of key/value pairs to be updated
withSuccess
Function to handle callback success and NSDictionary return data object
withFailure
Function to handle callback failure and NSString error message
void SkillzProgression.updateUserData(String namespace, Map<String, Object> userDataUpdates, ProgressionCallback callback)
Parameters​
namespace
One of the namespace String constants
userDataUpdates
Map of String/Object key/value pairs.
callback
ProgressionCallback object to handle callback success or failure. Must be defined in implementation.
Seasons API​
Get Current Season​
Fetch the full season of the current Season based on start and end time if one is currently active. This method uses callbacks to handle the successful fetch or an error if one occurs. If no season is active, this method will call the given success handler with null.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.GetCurrentSeason(Action<Season> successCallback, Action<string> failureCallback
Parameters​
successCallback
Action delegate to handle successful callback and the returned Season object. The method must be defined in the implementation
failureCallback
Action delegate to handle the failure callback and the returned error string. The method must be defined in the implementation
func getCurrentSeason(_ successCallback: (SKZSeason?) -> Void,
withFailure failureCallback: (String?) -> Void)
Parameters​
successCallback
Function to handle callback success and SKZSeason return data object
failureCallback
Function to handle callback failure and String error message
- (void)getCurrentSeason: ^(SKZSeason *season)successCallback
withFailure: ^(NSString *error)failureCallback
Parameters​
successCallback
Function to handle success callback and SKZSeason return data object
failureCallback
Function to handle failure callback and NSString error message
void SkillzProgression.getCurrentSeason(CurrentSeasonCallback callback)
Parameters​
callback
Implementation of CurrentSeasonCallback interface
Get Previous Seasons​
Fetch the full details of previous Seasons based on start and end time in chronological order. This returns previous seasons based on a given count. The seasons returned include the most recent season. For example, if requesting the previous 2 seasons, it will fetch the 2 most recently completed seasons in chronological order. The most recently ended season will be the end of the list. When no previous seasons exist, the fetch will return an empty list. The given count must be greater than 0. If the count is greater than the total number of previous seasons, as many previous seasons as possible will be returned.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.GetPreviousSeasons(int count, Action<List<Season>> successCallback, Action<string> failureCallback)
Parameters​
count
Number of previous seasons requested
successCallback
Action delegate to handle success callback and the returned List of Season objects. The method must be defined in the implementation
failureCallback
Action delegate to handle the failure callback and the returned error string. The method must be defined in the implementation
func getPreviousSeasons( _ count: Int32,
withSuccess successCallback: (NSArray?) -> Void,
withFailure failureCallback: (String?) -> Void)
Parameters​
count
Number of previous seasons requested
successCallback
Function to handle success callbackand NSArray of SKZSeason return data object
failureCallback
Function to handle failure callback and String error message
- (void)getPreviousSeasons: (int)count
withSuccess: ^(NSArray *seasons))successCallback
withFailure: ^(NSString *error))failureCallback
Parameters​
count
Number of previous seasons requested
successCallback
Function to handle success callback and NSArray of SKZSeason return data object
failureCallback
Function to handle failure callback and NSString error message
void SkillzProgression.getPreviousSeasons(long count, MultipleSeasonCallback callback)
Parameters​
count
Number of previous seasons requested
callback
Implementation of MultipleSeasonCallback interface
Get Next Seasons​
Fetch the full details of upcoming Seasons based on start and end time in chronological order. This returns upcoming seasons based on a given count. For example, if requesting the next 2 seasons, it will fetch the 2 upcoming seasons with the closest start times in chronological order. The closest season to starting will be the first season of the list. When no upcoming seasons exist, the fetch will return an empty list. The given count must be greater than 0. If the count is greater than the total number of upcoming seasons, as many upcoming seasons as possible will be returned.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java
void SkillzCrossPlatform.GetNextSeasons(int count, Action<List<Season>> successCallback, Action<string> failureCallback)
Parameters​
count
Number of upcoming seasons requested
successCallback
Action delegate to handle success callback and the returned List of Season objects. The method must be defined in the implementation
failureCallback
Action delegate to handle the failure callback and the returned error string. The method must be defined in the implementation
func getNextSeasons( _ count: Int32,
withSuccess successCallback: (NSArray?) -> Void,
withFailure failureCallback: (String?) -> Void)
Parameters​
count
Number of previous seasons requested
successCallback
Function to handle success callback and NSArray of SKZSeason return data object
failureCallback
Function to handle failure callback and String error message
- (void)getNextSeasons: (int)count
withSuccess: ^(NSArray *seasons)successCallback
withFailure: ^(NSString *error)failureCallback
Parameters​
count
Number of previous seasons requested
successCallback
Function to handle success callback and NSArray of SKZSeason return data object
failureCallback
Function to handle failure callback and NSString error message
void SkillzProgression.getNextSeasons(long count, MultipleSeasonCallback callback)
Parameters​
count
Number of previous seasons requested
callback
Implementation of MultipleSeasonCallback interface
Random Generator​
Random Value​
Use the Skillz random implementation to ensure each competitor receives the exact same random number.
- Unity/C#
- iOS/Swift
- iOS/Objective-C
- Android/Java