An Android TV optimized native Kotlin application that integrates directly with Google Drive to securely stream video files using a hardware-accelerated libVLC player. Look at that D-Pad navigation support go!
Before building and running the project, you must obtain a Google Cloud Platform (GCP) Service Account credentials.json file. This app uses Service Accounts rather than standard OAuth user sign-ins down to its automated design.
- Navigate to the Google Cloud Console.
- Create a New Project or select an existing one.
- In the sidebar, go to APIs & Services > Library.
- Search for "Google Drive API" and click Enable.
- In the sidebar, go to APIs & Services > Credentials.
- Click + CREATE CREDENTIALS at the top and select Service account.
- Name the service account (e.g., "DriveTV-Bot") and click Create and Continue, then Done.
- You will be redirected back to the Credentials tab. Look for the newly created Service Account email address—copy it (you will need it later to share folders).
- Under the Service Accounts section, click on the Email of the account you just created.
- Go to the KEYS tab at the top.
- Click ADD KEY > Create new key.
- Select JSON and click Create. This will download the file to your computer.
- Rename the downloaded file to exactly
credentials.json. - Place this file inside the Android project at the following path:
DriveTVApp/app/src/main/res/raw/credentials.json
Service accounts are essentially "bots." They only see what is explicitly shared with them; they do not have access to your personal Google Drive by default!
- Open your regular Google Drive in a browser.
- Find the folder containing the videos you want the TV app to see.
- Right-click the folder and select Share.
- Paste the Service Account Email Address (from Step 2.4) into the specific people bar.
- Set the permission to Viewer and click Send. (Uncheck "Notify people" to avoid an error, as Service Accounts don't have real inboxes).
- Important: The app currently defaults to showing folders at the "root" of the Service Account. Ensure you share the top-level folder!
- Android Studio Giraffe | 2022.3.1 or newer.
- JDK 17 integration.
- Minimum API: Android TV 10 (API level 29+).
- Open Android Studio and select Open. Point it to the
DriveTVApp/directory. - Wait for Android Studio to index the files and download the necessary Gradle wrappers (this repository targets Gradle 8.2).
- Verify that
DriveTVApp/app/src/main/res/raw/credentials.jsonexists in the Project tool window. - Click the Sync Project with Gradle Files (elephant icon) at the top right.
- To run on an emulator, set up an Android TV (1080p or 4K) AVD instance in the device manager targeting at least API 29.
- To run on a physical Android TV, enable Developer Options on the TV, enable Network Debugging (or USB Debugging), and connect to the TV via
adb connect <IP_ADDRESS>. - In Android Studio, select your TV emulator/device from the device dropdown.
- Click the green
▶️ Run 'app' button (or useShift + F10).
- 100% Kotlin Compose for TV (
androidx.tv.material3) targeting TV D-pads natively. - libVLC Android binding for high-performance MP4/MKV hardware-accelerated playback on slow generic TV chips.
- Repository Pattern / MVVM using Kotlin Coroutines for safe UI states.
- OkHttp / manual JWT generation (No heavy dependency on the full bulky Google Java API Client).