Connect SDK for Android

repository·master·Indexed 43 days ago

https://github.com/connectsdk/connect-sdk-android

An open source framework that abstracts discovery and connectivity between mobile apps and multiple TV platforms, including Chromecast, FireTV, DLNA, WebOS, and Netcast, using a unified API.

Tokens
1.1K
Snippets
6
Records
7
Agent score
6%

What's inside Connect SDK

  1. Subtitle format support and limitations

    master

    Subtitle support varies by service and format. Ensure your media servers meet the following requirements:

    ServiceSupported FormatRequirements / Notes
    DLNASRTTested on LG WebOS and Netcast TVs.
    FireTVWebVTTSubtitles are hidden by default; users must manually select them via the remote's 'Options' button.
    Google CastWebVTTServers must support CORS headers (e.g., Access-Control-Allow-Origin: *).
    NetcastSRTUses DLNA restrictions.
    WebOSWebVTTServers must support CORS headers.
  2. Include Connect SDK from source for FireTV support

    master

    To include Amazon Fling SDK support, you must build the SDK from source within your project. Follow these steps:

    1. Clone the repository and initialize submodules:

      cd your_project_folder
      git clone https://github.com/ConnectSDK/Connect-SDK-Android.git
      cd Connect-SDK-Android
      git submodule update --init
    2. Configure settings.gradle: In your project's root directory, modify settings.gradle to include the SDK module:

      include ':app', ':Connect-SDK-Android'
    3. Add the project dependency: In your app's build.gradle, add the local project dependency:

      dependencies {
          //...
          compile project(':Connect-SDK-Android')
      }
    4. Finalize setup:

      • Setup the FireTV submodule.
      • Sync the project with Gradle files.
      • Add the required permissions to your AndroidManifest.xml.
    cd your_project_folder
    git clone https://github.com/ConnectSDK/Connect-SDK-Android.git
    cd Connect-SDK-Android
    git submodule update --init
  3. Run SDK tests and generate coverage reports

    master

    The SDK includes unit tests using Robolectric, Mockito, and PowerMock. You can execute them using Gradle.

    To run tests:

    gradle test

    To generate a Jacoco test coverage report:

    gradle jacocoTestReport

    The report will be located at: Connect-SDK-Android/build/reports/jacoco/jacocoTestReport/html.

    gradle test
    
    gradle jacocoTestReport
  4. Enable Chromecast support with Metadata

    master

    To enable Chromecast support, you must include the Google Play Services version metadata within your <application> tag in the AndroidManifest.xml.

    <application ... >
        ...
    
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    
    </application>
  5. Include Connect SDK via Maven Central

    master

    To use the prebuilt version of the SDK, add the dependency to your app's build.gradle file.

    Note: This prebuilt library does not include Amazon Fling SDK support because the SDK is not available on Maven. If you require FireTV/Amazon Fling support, you must follow the "Including Connect SDK from sources" guide instead.

    dependencies {
        //...
        compile 'com.connectsdk:connect-sdk-android:1.6.0'
    }
  6. Configure Android Manifest permissions

    master

    The following permissions are required for Connect SDK to function correctly. Add them to your AndroidManifest.xml:

    • INTERNET & CHANGE_WIFI_MULTICAST_STATE: Required for SSDP and Chromecast/Zeroconf discovery.
    • ACCESS_NETWORK_STATE & ACCESS_WIFI_STATE: Required for interacting with devices.
    • WRITE_EXTERNAL_STORAGE: Required for storing device pairing information.
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />