tauri-docs icon indicating copy to clipboard operation
tauri-docs copied to clipboard

[request] Add Android TV Initial setup.

Open zonblade opened this issue 1 year ago • 0 comments

Question you want answered

How to setup Tauri v2 to run on Android TV

Where did you look for an answer?

based on Android TV Getting Started, there some settings need to be added Tauri does not generate this things

on AndroidManifest.xml

First :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET" />
    ...other permission...
    <!-- add below setup, after permission before application -->
    <uses-feature android:name="android.software.leanback"
        android:required="false" />

    <application
       ...

Secondly:

<activity
    android:name=".TvActivity"
      ...other setup...
    android:exported="true"
    android:label="@string/your_label">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        ...i dont set LEANBACK so i comment it...
        <!-- <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> -->
    </intent-filter>
</activity>

To be notes

there is this warning, before upgrade please make sure to check tauri capability.

WARNING: We recommend using a newer Android Gradle plugin to use compileSdk = 34

This Android Gradle plugin (8.0.0) was tested up to compileSdk = 33.

You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 34.

If you are already using the latest version of the Android Gradle plugin,
you may need to wait until a newer version with support for compileSdk = 34 is available.

To suppress this warning, add/update
    android.suppressUnsupportedCompileSdk=34

Other consideration

thou i can run my app now, I still didn't explore hardware api for TV os fully but at least tauri command / invoke working properly.

Page URL

https://developer.android.com/training/tv/get-started/create

Additional context

Tested on Android TV (api 33)

ezgif-6-1dfe8a0c68

Are you willing to work on this yourself?

  • [x] I want to work on this myself

zonblade avatar Aug 08 '24 15:08 zonblade