Deep Linking Support (Optional)

The Skillz SDK has a feature that allows promotional URL’s obtained through ads and emails to link directly into the Skillz interface and perform certain functionality automatically. For instance, a user could click on an URL that would automatically direct to the Skillz UI with a promo code pre-entered.

This “Deep Linking” feature is optional, but you will need to implement Deep Linking if you are working directly with Skillz on user acquisition.

Along with the below changes, you will also need to ensure that you've implemented the Skillz run script build phase, as is laid out in Step 5 here.

Objective-C

For native Objective-C games, Deep Linking requires the following methods to be overwritten in your implementation of SkillzDelegate for standard games and SkillzTurnBasedDelegate for turn based games:

shouldSkillzLaunchFromURL

This method needs to be overwritten to return YES when your game is in a state that Skillz can launch from. Usually this is any place besides mid-gameplay. The AppleDoc for this method contains additional details.

For example:

- (BOOL) shouldSkillzLaunchFromURL
{
    if ([self isInGameState]) {
        return NO;
    }
    return YES;
}

skillzWillLaunch

This method will be called before Skillz launches and provides and opportunity to clean up any game state and / or de-allocate resources so that Skillz can launch.

For example:

- (void) skillzWillLaunch {
    if ([self isInGameState]) {
        [self cleanGameState];
    } else if ([self isInMenuState]) {
        [self cleanMenuState];

Finally, in your game's implementation of UIApplicationDelegate you will need to add the following method:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation
{
    return YES;
}

Unity 

For Unity games, the process is similar. The main difference is that there is no equivalent delegate method for shouldSkillzLaunchFromURL. Instead, pass true to the method setShouldSkillzLaunchFromURL after initializing Skillz.

For example: 

// Start method in initial menu scene
void Start () {
	// General Skillz initialization
	Skillz.skillzInitForGameIdAndEnvironment("240", Skillz.SkillzEnvironment.SkillzSandbox);
	// Allow Skillz to launch
	Skillz.setShouldSkillzLaunchFromURL (true);
}

// Start method in game scene
void Start () {
	// Prevent Skillz from launching when in game
	Skillz.setShouldSkillzLaunchFromURL (false);
}

In SkillzDelegate.cs the override for skillzWillLaunch will be called before Skillz launches.

For example:

public void skillzWillLaunch (string param)
{
	// clean up any state or resources needed before Skillz launch
}