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
| Column | Limit | Meaning |
|---|---|---|
titulo | 30 chars | Card title, e.g. "Match score". |
valor | 12 chars | The big value, e.g. "2 x 1", "18°", "$5.42". |
detalhe | 80 chars | Shown at the top of the screen when the card has focus. |
cor | #RRGGBB | Background color. Transparency is ignored. |
acao | 500 chars, optional | An 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
- Nothing appears until the person turns your plugin on in Settings › Appearance › Plugins, which asks for the parental PIN.
- The OK is tied to your signing certificate. An update signed with another key is turned off until the person allows it again.
- At most 3 plugins are shown. Each read has a 2-second limit, done away from the screen thread: a slow plugin is skipped, never waited for.
- The card is read again every time the person returns to the home screen. Keep
queryfast and local (cache your data).
Questions or a plugin to show? Open an issue on the project page.