Put your app's card on the home screen

A plugin is your own Android TV app. It sends one short card (a title, a big value, a line of detail, a color) and the launcher draws it at the end of the Watch row, in its own style and with large letters. You never draw on the home screen, and the launcher never sends you anything about the person's apps, accounts or channels.

has two ready apps you can build and install today: a countdown to a date the person picks on the TV, and today's moon phase. No internet, no account. MIT No Attribution: copy it, rename the package, publish.

1. Declare a provider

<provider
    android:name=".CardProvider"
    android:authorities="com.example.score.card"
    android:exported="true">
    <intent-filter>
        <action android:name="tv.sofaly.plugin.CARTAO" />
    </intent-filter>
</provider>

2. Answer content://<authority>/cartao with one row

ColumnLimitMeaning
titulo30 charsCard title, e.g. "Match score".
valor12 charsThe big value, e.g. "2 x 1", "18°", "$5.42".
detalhe80 charsShown at the top of the screen when the card has focus.
cor#RRGGBBBackground color. Transparency is ignored.
acao500 chars, optionalAn intent: URI opened on OK. It must stay inside your own package: no component=, no selector, no other package=. Without it, OK opens your app.
class CardProvider : ContentProvider() {
    override fun onCreate() = true
    override fun query(uri: Uri, p: Array<String>?, s: String?, a: Array<String>?, o: String?): Cursor =
        MatrixCursor(arrayOf("titulo", "valor", "detalhe", "cor", "acao")).apply {
            addRow(arrayOf("Match score", "2 x 1", "Second half, 40 min", "#1E8E3E", null))
        }
    // insert/update/delete/getType: return null or 0
}

Control characters and extra spaces are removed, and longer text is cut. A row with neither a title nor a value is ignored.

3. What the person sees

Questions or a plugin to show? Open an issue on the project page.