Android streaming

Streaming Plugin implements Android streaming with a separate application. In addition to the content rendered by Kanzi, Android Streaming Application can capture content that the Android system renders, such as the notification drawer, which is not possible with a Kanzi plugin. You can find the Android Streaming Application APKs at <Kanzi VR Package>\plugins-streaming\applications\android-streaming\bin.

Android Streaming Application offers these methods for injecting input from the receiver to the Android system:

Setting up Android Streaming Application with Kanzi Injector Service

Kanzi Injector Service is the recommended input injection method for Android Streaming Application. You can set up Kanzi Injector Service on a device where you do not have access to the platform signing key.

To set up Android Streaming Application with Kanzi Injector Service:

  1. Install Android Streaming Application using adb:

    adb install -r kanzi-streaming-signed-release.apk
    
  2. On your Android device go to Settings > Accessibility and in the list of downloaded apps tap Kanzi Injector Service.

    ../_images/android-accessibility-menu.png
  3. Enable Kanzi Injector Service. You can also enable a shortcut to toggle Kanzi Injector Service on and off.

    ../_images/enable-injector-service.png

Setting up Android Streaming Application with platform signature

Android Streaming Application requires signature-level permissions to inject input using restricted APIs. For this reason you must sign the application with the platform key of your system image. In the Android documentation see Signing Build for Release.

To sign and install the streaming application:

  1. Install the required tools:

    1. Install Android Studio. See https://developer.android.com/studio.

    2. In Android Studio, select Tools > SDK Manager, select the SDK Tools tab, and install the the Android SDK Build-Tools and Android SDK Platform Tools.

      ../_images/android-sdk-manager.png
    3. In the SDK Manager look up the Android SDK Location.

  2. Sign an APK with your platform keys using apksigner. See https://developer.android.com/studio/command-line/apksigner.

    If apksigner is not in your PATH, you can find it in the <Android SDK Location>/build-tools/<version>/ directory.

    If you are using a pre-built AOSP image, you can skip signing and use a pre-signed APK kanzi-streaming-signed-[release/debug].apk.

    To sign an APK:

    • If you are using a keystore, run:

      apksigner sign --ks <keystore> --out kanzi-streaming-release.apk kanzi-streaming-unsigned-release.apk
      
    • If you are using a key and a certificate, run:

      apksigner sign --key <key>.pk8 --cert <cert>.x509.pem --out kanzi-streaming-release.apk kanzi-streaming-unsigned-release.apk
      
  3. Connect your device and install the signed application with adb. See https://developer.android.com/studio/command-line/adb#Enabling and https://developer.android.com/studio/command-line/adb.

    If adb is not in your PATH, you can find it in the <Android SDK Location>/platform-tools/ directory.

    To install the signed APK:

    adb install -r kanzi-streaming-release.apk
    

Starting and configuring an Android stream

This section covers how to start and configure an Android stream.

To start and configure an Android stream:

  1. Open the application on your Android device and tap Start Stream.

    When the application asks for permission to record the screen, tap Start Now.

    ../_images/android-record-permission.png
  2. Verify that the injection method is correct.

    To forward input from receivers to the Android device, Android Streaming Application requires a valid input method.

    ../_images/injection-method-none.png ../_images/injection-method-accessibility.png ../_images/injection-method-signature.png
  3. Connect a receiver to the stream using the IP address and port that you can see in the application UI. You can use any Stream ID for an Android stream. For methods on how to configure a receiver, see Configuration.

    If you cannot use the configured port of the stream, in the application set the port in the Port, and tap Update Port.