Adding the Skillz Library

 

These steps will teach you how to add the Skillz SDK to your project. 

Step 1: Add Skillz Maven Repository

The Skillz Android SDK and its dependencies reside in the Skillz maven repository. In your build.gradle file, you will need to add this maven repository so that it can later add the Skillz SDK to your project.

Add the Skillz repository like so:

repositories { 
     maven { 
         url 'http://nexus.skillz.com/content/groups/public/' 
     } 
}

Step 2: Adding the Skillz SDK Dependency


In the same file (build.gradle) where you added the Skillz maven repository, you will now add the Skillz SDK dependency like so:

dependencies { 
     ... 
     compile 'com.skillz.sdk:skillz-sdk-android:4.1.0' 
     ...
}

Note that the version specified in the example above, '4.1.0', is a hardcoded version number. You will have to update this version number whenever a new Skilllz Android SDK goes live unless you want to use a specific version other than the newest one. You can get the latest Android SDK version number by clicking on the “See version notes here” button in the downloads tab of your Skillz Developer Portal.


To make updating dependencies easier, Android Studio will highlight outdated dependencies in your build.gradle files. Furthermore, you can hover the cursor over the dependency in Android Studio to bring up a tooltip with information about the updated version, including the new version number.



Step 3: Ensure Android SDK version compatibility

 

In your build.gradle file, you will need to ensure the Android SDK version compatibility. Skillz requires a minSdkVersion of 19 or higher, and works best with a compiledSdkVersion of 25 and targetSdkVersion of 22. If you want to learn more about what's the difference between compiledSdkVersion and targetSdkVersion, you can check out the official Android developer documentation.

Android {
   compileSdkVersion 25
   buildToolsVersion "25.0.2"

   defaultConfig {
      applicationId "com.skillzgames.caverun"
      minSdkVersion 19
      targetSdkVersion 22
   }
}

A targetSdkVersion of 23 (6.0) or higher will cause permission problems. Users may be repeatedly asked to grant location permissions, even if they have done so in the past. This is due to the new on-demand permissions paradigm introduced with this version of Android. Setting your targetSdkVersion values to 22 will avoid these issues.

Ensure minSdkVersion is set to 19 or higher and that the targetSdkVersion is set to 22 or higher within the android { defaultConfig { } } block of your build.gradle file.

Additionally, ensure that the compiledSdkVersion within the android block is set to 25 or lower.

Finally, set the uses-sdk line within the <manifest> block of your AndroidManifest.xml file to match these settings:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.skillz.caverun" />
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="22" /> 

Step 4: Setting Skillz meta-data

 

Add the following lines in your Android Manifest’s <application> block:

<application>
    <!-- Make sure the Skillz <meta-data> tags are all direct children of the <application> tag, otherwise the game won't run properly! -->
    <meta-data android:name="skillz_game_id" android:value="" />
    <meta-data android:name="skillz_production" android:value="false" />
    <meta-data android:name="skillz_orientation" android:value="portrait" />
    <meta-data android:name="skillz_game_activity" android:value="" />
    <meta-data android:name="skillz_allow_exit" android:value="true" />
</application>

Now, edit each meta-data line to contain the correct information for your game.

<meta-data android:name="skillz_game_id" android:value="" />

Set the value to your Skillz Game ID from the Skillz Developer Portal. You can obtain your Game ID by going to your developer portal.

<meta-data android:name="skillz_production" android:value="false" />

Set this value to “false” for testing in the sandbox environment. When you are ready to move to production and before uploading a binary in your developer portal, set this value to “true”.

<meta-data android:name="skillz_orientation" android:value="portrait" />

Set this value to “portrait” or “landscape” depending on your game’s orientation. Games that rotate between landscape and portrait are not supported at this time.

<meta-data android:name="skillz_game_activity" android:value="" />

Set the value to the name of the activity Skillz should launch when a user enters a Skillz match. Skillz requires a fully-qualified path, example: “com.skillzgames.caverun.GameActivity”.

<meta-data android:name="skillz_allow_exit" android:value="true" />

Set the value to “true” to allow users to exit the Skillz interface back to the main menu of your game. Set the value to “false” if your game is Skillz-only and there is no main menu of your game.

 

 

Step 5: Configuring FCM push notifications (Optional)

 

GCM has been deprecated by Google and made Firebase Cloud Messaging their new push notification system. Skillz now support this feature. You can learn how to set up FCM here. If you have already integrated GCM in your game and would like to migrate to FCM, you can read about that here.

 

Next Steps

After completing these steps, the Skillz SDK should be properly included in your project and you should be able to compile your game without errors.

The next step is to perform the core integration!