Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a Android TV app without using leanback lib

Im new to Android TV development. I want to build an app without using leanback lib.But Android Studio automatically attaching leanback when selecting the platform as TV. How do i remove it?

PS- My app is going to run inside a webview .

private AdvancedWebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mWebView = (AdvancedWebView) findViewById(R.id.webview);
    mWebView.setListener(this, this);
    mWebView.loadUrl("url for app hosted on server");
}

Is it a good decision for TV apps?

thank you

like image 696
san88 Avatar asked Jul 06 '26 01:07

san88


1 Answers

You don't need any of the android tv libraries or even to setup your project as an android tv project to get it on the android tv play store. I set my project up as a standard app (all those support libs make your apk large). Put a 320x180 icon in drawable. In the manifest just add

     <uses-feature android:name="android.software.leanback" android:required="false" />
     <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
     android:banner="@drawable/banner"
     <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>

If your using a webview and your ui is gonna be the same across all platforms you can use the leanback launcher intent in the same activity as your regular activity.

That's it.

like image 52
asadullah Avatar answered Jul 07 '26 13:07

asadullah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!