EddyVerbruggen / nativescript-android-tv

A little PoC demonstrating code sharing between Android Phone and TV apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NativeScript ❤️ Android TV

What?

Unsurprisingly Android TV is very much like the Android you know and love, and since NativeScript already runs like a champ on Android, you can easily support Android TV as well!

How?!

I found the easiest way to support TV devices is adding this line to your AndroidManifest.xml and figuring out at runtime which UI to load.

Wait.. does that mean I have to duplicate code?

You don't have to duplicate anything, but you really don't want to reuse phone layouts on your TV for obvious reasons. So what this PoC does, is using a main-page.xml for Phone / Tablet, and main-page-tv.xml for TV to accomodate for the additional screen real estate - but they share the same main-view-model.ts.

Can I use Angular or Vue as well?

Sure you can, as those eventually render the same UI widgets as regular NativeScript does.

And what about iOS?

Nothing special there - iOS is powered by the same code that makes the Android Phone / Tablet version tick.

Sorry, I meant Apple TV

Ah, OK, ehm, please refer to this blog.

Lemme try

Create an Android TV emulator with the AVD manager inside Android Studio (if you're not so lucky to own a real device), then:

git clone https://github.com/EddyVerbruggen/nativescript-android-tv
cd nativescript-android-tv
npm i
tns run android

About

A little PoC demonstrating code sharing between Android Phone and TV apps


Languages

Language:TypeScript 86.0%Language:CSS 14.0%