Instrumenting Android TV

Assuming that you use Gradle, then instrumenting Android TV application requires only a few easy steps. Before continuing you should have a working Android TV device in your Suitest account.

API level 25 minimum

The app must be built with a minimum API level of 25. If you are unsure about the API level, contact your android app developer.


Native apps

  1. Download the Suitest instrumentation library for Android TV and copy it into the libs folder.

  2. In your build.gradle file add the following code. If you are unsure on what to do please refer to our build.gradle example and the troubleshooting section.

    If you want Suitest to work only with debug builds:

    dependencies {
        //Minimal version for suitest is 25.2.0, you can use any higher.
        debugImplementation 'com.android.support:appcompat-v7:25.2.0'
        debugImplementation 'com.google.code.gson:gson:2.8.0'
        debugImplementation(name:'SuitestIL', ext:'aar')
        releaseImplementation(name:'SuitestILproduction', ext:'aar')
    }
    

    If you want Suitest to work in all modes including release:

    dependencies {
        //Minimal version for suitest is 25.2.0, you can use any higher.
        debugImplementation 'com.android.support:appcompat-v7:25.2.0'
        debugImplementation 'com.google.code.gson:gson:2.8.0'
        implementation(name:'SuitestIL', ext:'aar')
    }
    

    In case you are using older version of the Gradle plugin which does not understand Implementation, please use the following code:

    dependencies {
        debugCompile 'com.google.code.gson:gson:2.8.0'
        debugCompile(name:'SuitestIL', ext:'aar')
        releaseCompile(name:'SuitestILproduction', ext:'aar')
    }
    

    You must also add flatDir {dirs 'libs'} as shown in the following example:

    allprojects {
        repositories {
            jcenter()
            flatDir {
                dirs 'libs'
            }
        }
    }
    
  3. Extend the Application class by adding SuitestInstrumentalApplication.init(this); to the onCreate method. The final result should look like this:

    public class MainApplication extends Application {
    
        @Override
        public void onCreate() {
            super.onCreate();
            SuitestInstrumentalApplication.init(this);
        }
    }
    

HTML hosted (WebView) apps

  1. Download the Suitest instrumentation library for Android TV and copy it into the libs folder.

  2. In your build.gradle file add the following code. If you are unsure on what to do please refer to our build.gradle example and the troubleshooting section.

    If you want Suitest to work only with debug builds:

    dependencies {
        //Minimal version for suitest is 25.2.0, you can use any higher.
        debugImplementation 'com.android.support:appcompat-v7:25.2.0'
        debugImplementation 'com.google.code.gson:gson:2.8.0'
        debugImplementation(name:'SuitestIL', ext:'aar')
        releaseImplementation(name:'SuitestILproduction', ext:'aar')
    }
    

    If you want Suitest to work in all modes including release:

    dependencies {
        //Minimal version for suitest is 25.2.0, you can use any higher.
        debugImplementation 'com.android.support:appcompat-v7:25.2.0'
        debugImplementation 'com.google.code.gson:gson:2.8.0'
        implementation(name:'SuitestIL', ext:'aar')
    }
    

    In case you are using older version of the Gradle plugin which does not understand Implementation, please use the following code:

    dependencies {
        debugCompile 'com.google.code.gson:gson:2.8.0'
        debugCompile(name:'SuitestIL', ext:'aar')
        releaseCompile(name:'SuitestILproduction', ext:'aar')
    }
    

    You must also add flatDir {dirs 'libs'} as shown in the following example:

    allprojects {
        repositories {
            jcenter()
            flatDir {
                dirs 'libs'
            }
        }
    }
    
  3. Extend the Application class by adding SuitestInstrumentalApplication.webViewInit(this); to the onCreate method. The final result should look like this:

    public class MainApplication extends Application {
    
        @Override public void onCreate() {
            super.onCreate();
            SuitestInstrumentalApplication.webViewInit(this);
        }
    }
    
  4. Insert the following code before you load content into the WebView.

    SuitestWebViewInstrumentation.instrument(webView);
    
  5. Instrument your HTML hosted app.

    Copy and paste the code snippet from the Suitest configuration page into every HTML file of your hosted application. For best results put it as the first script element in your HTML file right after the opening tag.

Open URL in WebView

For Open URL to work inside of WebView you need to adjust WebViewClient with shouldOverrideUrlLoading method returning false. Read more in the Android developer documentation.

debugCompile

debugCompile will include the Suitest IL to debug builds only. releaseCompile will include an empty (without functionality) Suitest IL that only contains the method SuitestInstrumentalApplication.init(this) which is necessary to avoid receiving errors on release builds, it will not alter or effect your release builds. If releaseCompile line is not included then you'll need to remove all Suitest code added from each release build.

ProGuard

If you are using ProGuard add the following code to your ProGuard configuration file to suppress irrelevant warnings and allow the instrumentation library to function correctly:

-dontwarn st.suite.**
-dontnote st.suite.**
-keep class st.suite.android.** {*;}

Uploading the build to Suitest

After you have instrumented the code create a development build of your application and upload it at the Suitest configuration page. If you are using an HTML hosted (WebView) app then do not forget to check the "This is an HTML based application" checkbox under the file name before saving.

This is an HTML based application - checkbox
This is an HTML based application - checkbox

Suitest will automatically install or update the package on the device as necessary when you try running the app on this device.

The app build must have the versionCode incremented, so that Suitest knows to re-install the new package. Read more about it inside of Android developers documentation.

If you use Suitest Network API you can also send the package with an API request. Suitest will automatically install or update the package on the device as necessary when you try running the app on this device.

Setting up Suitestify

You can optionally set up Suitestify with any HTML based hosted application.