Mobile Deep Links
Introduction
Deep links allow third party mobile apps and mobile web sites to bring users to a specific place within a Twitch app. This guide explains how to check whether the Twitch App is installed and describes deep link formats.
Deep links are important because they allow tighter integration with Twitch on mobile apps. For example, an app that helps a broadcaster manage his channel could link directly to the user’s dashboard within the Twitch App (as opposed to just launching the app and leaving the user on the “Following” tab).
You can find more information about deep links here. For support, visit the Twitch Developer Forums.
Checking Whether the Twitch App is Installed
You can check whether the Twitch App is already installed on a mobile device as follows:
On iOS Objective C
NSURL *twitchURL = [NSURL URLWithString:@"twitch://open"];
if ([[UIApplication sharedApplication] canOpenURL:twitchURL]) {
// The Twitch app is installed, do whatever logic you need, and call -openURL:
} else {
// The Twitch app is not installed. Prompt the user to install it!
}
On iOS Swift
let twitchURL = NSURL(string: "twitch://open")
if (UIApplication.sharedApplication().canOpenURL(twitchURL!)) {
// The Twitch app is installed, do whatever logic you need, and call -openURL:
} else {
// The Twitch app is not installed. Prompt the user to install it!
}
Note: On both iOS platforms, you also must change your app’s Info.plist file to declare that your app is allowed to query the twitch scheme. See the Apple documentation for detailed information.
On Android
// Where “packagename” is the package name of the Twitch app:
private boolean isPackageInstalled(String packagename, Context context) {
PackageManager pm = context.getPackageManager();
try {
pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
return true;
} catch (NameNotFoundException e) {
return false;
}
}
Deep Link Formats
To launch the Twitch App, use twitch://open.
| To launch the Twitch App and go to a specific … |
Use this URL |
|---|---|
| Channel | twitch://stream/– OR – twitch://open?stream= |
| Game directory | twitch://game/– OR – twitch://open?game= |
| VOD | twitch://video/– OR – twitch://open?video=For a VOD with this URL: twitch.tv/some_channel/v/1234567the video_id is v1234567. |
| Channel activity feed (includes VODs) | twitch://channel/– OR – twitch://open?channel= |
| User’s “following” directory (first tab in the app) |
twitch://followingIf the user is not logged in, this goes to the login page |
| Login page | twitch://login |
| Chat room | twitch:// |
| Category tag | twitch://directory/tags/ |
| Live-stream tag | twitch://directory/all/tags/ |