tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.95k stars 2.6k forks source link

[feat] Some additional setting need to add, to work with Android TV #10534

Closed zonblade closed 3 months ago

zonblade commented 3 months ago

Describe the problem

Problems

For running android TV, i found that the Application is fully running without error but wont show up on Android TV os/Google TV os. it turns out android has some more setting to do in their AndroidManifest.xml

i think this will nice if tauri generate it for example

npx tauri android init --with-tv

Describe the solution you'd like

Soultions

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

Alternatives considered

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.

Additional context

Tested on Android TV (api 33)

ezgif-6-1dfe8a0c68

zonblade commented 3 months ago

my project based on Tauri 2.0.0-rc.1 lineup