This guide assumes that you have a Cordova project already set up, have iOS and/or Android platforms added, and installed the Cordova device plugin. Check out Cordova's Getting Started guide for more information.
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
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 instructions for integrating your game with the Skillz SDK.
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 for installing the Skillz iOS SDK on how to add this file to your Xcode Project.
Your Xcode project should reside in
After installing the Skillz SDK to your Xcode project, you should now be able to compile your iOS project.
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 build ioscommands.
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.