All Skillz Cordova Plugin Methods

SkillzCordova methods

skillzInit(gameId, environment)

Initializes Skillz.

  • Void
  • Both gameId and environment are strings
  • The Skillz environment should be 'SkillzSandbox' for testing purposes and 'SkillzProduction' when you’re ready to go live.

launchSkillz()

Launches the Skillz UI.

  • Void

isMatchInProgress(completion)

Returns true if a Skillz match is in progress.

  • Returns a boolean
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

reportScore(score, matchId)

Reports the final score of the user and returns to the Skillz UI.

  • Void
  • Both score and match ID should be a number.

updatePlayersCurrentScore(score, matchId)

Updates the user’s current score.

  • Void
  • Both score and matchId should be a number.

abortMatch(matchId)

Aborts the match for the user and returns to the Skillz UI.

  • Void
  • matchId should be a number

getMatchRules(completion) 

Returns the game parameters that were set in the Developer Console.

  • Returns a JSON object
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

getMatchInfo(completion) 

Returns the current match’s information.

  • Returns a JSON object
  • This match information object will contain the match id which will be used for updatePlayersCurrentScore, reportScore, and abortMatch function calls.
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

getCurrentPlayer(completion)

Returns the current player’s information.

  • Returns a JSON object
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

addMetaDataForMatchInProgress(metaDataJsonString, isMatchInProgress)

Adds the meta data of a match to the Skillz database.

  • Void
  • metaDataJsonString should be a JSON string while isMatchInProgress should be a boolean.

getSDKVersion(completion)

Returns the current Skillz SDK your app is on.

  • Returns a string
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

getRandomNumber(completion)

Returns a random number.

  • Returns a number
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

getRandomFloat(completion) 

Returns a random float.

  • Returns a float
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

getRandomNumberWithRange(min, max, completion) 

Returns a random Number between the minimum and maximum value you passed in.

  • Returns a number
  • Asynchronous, so a completion block is passed in. You can use this completion block to set a local variable to the return value of this function.

SkillzDelegateCordova methods

Here is a list of all the SkillzDelegateCordova method calls that are available to you. These functions are called by the Skillz SDK.

onMatchWillBegin(matchInfoString)

Called by Skillz when a match is about to begin

  • When this function gets called, the matchInfo variable inside SkillzDelegateCordova gets set. You’ll be able to use this variable to set any game values needed when starting a match.

onSkillzWillExit()

Called by Skillz when a user chooses to exit the Skillz experience through the side menu.

getMatchInfo()

Returns information of the current match.

  • Returns an object