tree: 352c2d024f7c4b2c5c55b7ca8a07db3ef1b9abf1 [path history] [tgz]
  1. App/
  2. third_party/
  3. .gn
  4. args.gni
  5. BUILD.gn
  6. README.md
examples/tv-casting-app/android/README.md

Matter TV Casting Android App Example

This is a Matter TV Casting Android app that can be used to cast content to a TV. This app discovers TVs on the local network that act as commissioners, lets the user select one, sends the TV a User Directed Commissioning request, enters commissioning mode, advertises itself as a Commissionable Node and gets commissioned. Then it allows the user to send Matter ContentLauncher commands to the TV.

Requirements for building

You need Android SDK 21 & NDK 23.2.8568313 downloaded to your machine. Set the $ANDROID_HOME environment variable to where the SDK is downloaded and the $ANDROID_NDK_HOME environment variable to point to where the NDK package is downloaded.

ABIs and TARGET_CPU

TARGET_CPU can have the following values, depending on your smartphone CPU architecture:

ABITARGET_CPU
armeabi-v7aarm
arm64-v8aarm64
x86x86
x86_64x64

Gradle & JDK Version

We are using Gradle 7.1.1 for all android project which does not support Java 17 (https://docs.gradle.org/current/userguide/compatibility.html) while the default JDK version on MacOS for Apple Silicon is ‘openjdk 17.0.1’ or above.

Using JDK bundled with Android Studio will help with that.

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/

Preparing for build

Complete the following steps to prepare the Matter build:

  1. Check out the Matter repository.

  2. Run bootstrap (only required first time)

    source scripts/bootstrap.sh
    

Building & Installing the app

This is the simplest option. In the command line, run the following command from the top Matter directory:

./scripts/build/build_examples.py --target android-arm64-tv-casting-app build

(To build this app with no debugging hooks, use the android-arm64-tv-casting-app-no-debug target)

See the table above for other values of TARGET_CPU.

The debug Android package app-debug.apk will be generated at out/android-$TARGET_CPU-tv-casting-app/outputs/apk/debug/, and can be installed with

adb install out/android-$TARGET_CPU-tv-casting-app/outputs/apk/debug/app-debug.apk

You can use Android Studio to edit the Android app itself and run it after build_examples.py, but you will not be able to edit Matter Android code from src/controller/java, or other Matter C++ code within Android Studio.