All Skillz Cordova Method Calls

All Skillz Cordova Method Calls

 

Here is a list of all the Skillz Cordova method calls that are available to you.

  • SkillzCordova.skillzInit(gameId, environment) - this method is used to initialize 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.
  • SkillzCordova.launchSkillz() - this method is used to launch the Skillz experience
    • Void
  • SkillzCordova.isMatchInProgress(completion) - this method returns true if a skillz match is in progress
    • Returns a boolean
    • Uses a JS promise, 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.
  • SkillzCordova.reportScore(score, matchId) - this method reports the final score of the user.
    • Void
    • Both score and match ID should be a number.
  • SkillzCordova.updatePlayersCurrentScore(score, matchId) - this method updates the user’s current score.
    • Void
    • Both score and match ID should be a number.
  • SkillzCordova.abortMatch(matchId) - this method aborts the user
    • Void
    • MatchId should be a number
  • SkillzCordova.getMatchRules(completion) - this method returns the game parameters that were set in the Developer Console.
    • Returns a JSONObject
    • Uses a JS promise, 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.
  • SkillzCordova.getMatchInfo(completion) - this method returns the current match’s information.
    • Returns a JSONObject
    • This match information object will contain the match id which will be used for updatePlayersCurrentScore, reportScore, and abortMatch function calls.
    • Uses a JS promise, 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.
  • SkillzCordova.getCurrentPlayer(completion) - this method returns the current player’s information.
    • Returns a JSONObject
    • Uses a JS promise, 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.
  • SkillzCordova.addMetaDataForMatchInProgress(metaDataJsonString, isMatchInProgress) -  this method is used to add the meta data of a match to the Skillz database
    • Void
    • metaDataJsonString should be a Json String while isMatchInProgress should be a boolean.
  • SkillzCordova.getSDKVersion(completion) -  this method returns the current Skillz SDK your app is on.
    • Returns a string
    • Uses a JS promise, 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.
  • SkillzCordova.getRandomNumber(completion) -  this method returns a random number
    • Returns a number
    • Uses a JS promise, 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.
  • SkillzCordova.getRandomFloat(completion) -  this method returns a random float
    • Returns a float
    • Uses a JS promise, 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.
  • SkillzCordova.getRandomNumberWithRange(min, max, completion) -  this method returns a random Number between the minimum and maximum value you passed in
    • Returns a Number
    • Uses a JS promise, 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.

 

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

  • onMatchWillBegin - this function is 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 - this function is called by Skillz when a user chooses to exit the Skillz experience through the side menu.
Was this article helpful?
1 out of 1 found this helpful

0 Comments

Article is closed for comments.