Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

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

Notifications You must be signed in to change notification settings

EddyVerbruggen/nativescript-android-tv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published