Android TV SDK Setup

How to install the Airship SDK on Android TV.

You can use Airship to send messages to your app on Android TV devices. Create Android TV messages the same way as messages for Android devices and then target the corresponding platform to reach the Android TV devices. To target Android TV, you just need to send the message to Android. The messages can be sent via Push Notification, In-App Messages and In-App Automation, and Message Center by specifying users (segment, named user, or channel ID).

The following message types are supported for Android TV, without the need for development work.

Message TypeAndroid TV
Push NotificationA message that can appear on any screen on a mobile device. Push notifications appear as banners.
In-App AutomationMessages that are cached on users’ devices and displayed when your users meet certain conditions within your app, such as viewing a particular screen or opening the app a certain number of times.1
Message CenterA place in your app where you can display persistent rich messages, including HTML, video, etc. Similar to email, Message Center represents both the medium (the in-app inbox) and the message type (the messages you send to the inbox).2
In-App MessageA message that appears inside of your app. You can send in-app messages to your entire app audience, not just users who have opted-in to push notifications. (standard)

1. Modal, Fullscreen, and Banner message styles are supported.
2. The OpenExternalUrlAction to open URLs in messages will not work, as Android TV does not have a web browser.

Requirements

  • Minimum Android version supported 21+
  • Compile SDK version 31+

SDK Installation

The Airship SDK is split into modules which allow you to choose the push providers and features to be included in your application. Android TV receives messages via FCM, so you’ll need to include the urbanairship-fcm provider in order to receive notifications.

Example installation

app build.gradle.kts

dependencies {

    val airshipVersion = "16.8.0"
    
    // FCM push provider
    implementation("com.urbanairship.android:urbanairship-fcm:$airshipVersion")
    
    // In-App Automation
    implementation("com.urbanairship.android:urbanairship-automation:$airshipVersion")
    
    // Message Center
    implementation("com.urbanairship.android:urbanairship-message-center:$airshipVersion")
}
 Note

All Airship dependencies included in the build.gradle.kts file should all specify the exact same version.

app build.gradle

dependencies {

    def airshipVersion = "16.8.0"
    
    // FCM push provider
    implementation "com.urbanairship.android:urbanairship-fcm:$airshipVersion"
    
    // In-App Automation
    implementation "com.urbanairship.android:urbanairship-automation:$airshipVersion"
    
    // Message Center
    implementation "com.urbanairship.android:urbanairship-message-center:$airshipVersion"
}
 Note

All Airship dependencies included in the build.gradle file should all specify the exact same version.

FCM setup

Follow FCM Android Setup to configure your Android application to connect to Firebase.

Configure and initialize Airship

Android TV is supported via the native Android Airship SDK, and makes use of the same process to configure and initialize Airship on Android TV devices. Refer to the Android SDK Setup guide for further set up instructions.