Install the Skillz Cordova Plugin

By now, your HTML5 game has been migrated to Cordova, iOS and/or Android platforms have been added, and the Device Plugin is installed. You're now ready to install the Skillz Cordova plugin.

Manually installing the plugin

Download the Skillz Cordova plugin here. Decompress the file to a folder that will not be removed. Now, open the Terminal app and run:

cordova plugin add skillz-crossplatform-cordova --save --searchpath <plugin-path>

This will save (in config.xml) the location of where to search for the plugin if it is removed from the plugins folder and needs to be re-added.

Installing the plugin via NPM

The Skillz Cordova plugin is also available as an NPM package. Installing it is straightforward. Open the Terminal app, change to your app's directory and run:

cordova plugin add skillz-crossplatform-cordova --save

Reference SkillzCordova.js and SkillzDelegateCordova.js

The Skillz Cordova plugin will contain two files that are copied to the platform_www/ folder of each platform. These files are SkillzCordova.js and SkillzDelegateCordova.js. They need to be loaded in index.html in order to integrate with Skillz. To do so, add these lines:

<script src="SkillzCordova.js"></script>
<script src="SkillzDelegateCordova.js"></script>
 
SkillzCordova is a static class that will be used to integrate with Skillz.
 
SkillzDelegateCordova is a static class that contains two callbacks: onMatchWillBegin, and onSkillzWillExit. The former is called before a match will begin, while the latter is called if the user exits Skillz via the hamburger menu. You will need to add logic to start your game in onMatchWillBegin.
 
These two classes be covered more in-depth in the "Integrate Skillz SDK" section.
 

iOS specific steps

Install the Skillz.framework file

The Skillz Cordova plugin contains a Skillz.framework file that you will add to your Xcode Project. Follow the steps on this article on how to add the Skillz SDK to your Xcode Project.

Your Xcode project should reside in <app-root>/platforms/ios.

After installing the Skillz SDK to your Xcode project, you should now be able to compile your iOS project.

warning.png Warning

Cordova treats the Xcode project as a build artifact; it can be regenerated simply by running:

cordova platform remove ios
cordova platform add ios

Additionally, the Xcode project can be regenerated when running cordova prepare or cordova build ios commands.

You'll have to add the Skillz SDK to your Xcode project every time it is regenerated - be careful!

Android specific steps

No additional steps are needed on Android if you plan on building and testing it from the Cordova command-line interface. However, if you will be working from within Android Studio, then the <uses-sdk> element needs to be removed from platforms/android/CordovaLib/AndroidManifest.xml. Otherwise, the Gradle Sync process will fail.

Next steps

You're now ready to integrate the Skillz SDK!