Android TV SDK Setup

Airship SDK support and setup for Android TV applications

You can use Airship to send messages to your app on Android TV devices. You can also control which features are available in your app.

Message type and feature support

Send to Android TV devices in the same way as for Android mobile devices. In the dashboard, select the Android channel. Using the API, specify android_channel in the audience object.

Message types supported for Android TV without development work:

Message typeComments
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.Modal, fullscreen, and banner message styles are supported.
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).The OpenExternalUrlAction to open URLs in messages will not work since Android TV does not have a web browser.

These are also supported for Android TV but require development work:

Message type or featureComments
Push NotificationA message that can appear on any screen on a mobile device. Push notifications appear as banners.You can send notification payloads to the app, but they do not display natively. You must build a toast view to display the message on the Android TV home screen or inside the app.
Feature FlagA toggle for controlling the availability of content or functionality in your app or website.After creating a flag in the dashboard, you can access it by its name in the SDK after takeOff. To generate the Feature Flag Interaction Event, you must manually call trackInteraction with the flag. See Feature Flags in our mobile platform documentation.

Requirements

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

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 = "17.7.3"
    
    // 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")

    // Feature Flags
    implementation("com.urbanairship.android:urbanairship-feature-flag:$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 = "17.7.3"
    
    // 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.