# TiviLux in-app updater

TiviLux Native 0.2.8 checks this manifest URL after startup:

`https://play.theappdrop.store/tivilux-updates/latest.json`

The URL is configured in `app/build.gradle.kts` as `UPDATE_MANIFEST_URL`.
If you host APK updates somewhere else, change only that value before building.


## Before testing the updater

The app only checks the URL above; the project does **not** create that public web path for you. Upload `latest.json` to that exact location on your APK/download host and upload each release APK beside it. Until the manifest exists publicly, automatic checks quietly do nothing and **Settings > Account & About > Check for Updates** will report the server error.

The first updater-capable build (0.2.8) still has to be installed once using your normal APK-builder/download process. After 0.2.8 is installed, future builds such as 0.2.9 can be delivered through the in-app updater.

## latest.json format

```json
{
  "versionCode": 13,
  "versionName": "0.2.9",
  "apkUrl": "https://play.theappdrop.store/tivilux-updates/TiviLux-Native-v0.2.9.apk",
  "required": false,
  "sha256": "",
  "notes": [
    "Faster TV Guide",
    "Player improvements",
    "Bug fixes"
  ]
}
```

Rules:

- `versionCode` must be higher than the installed build. 0.2.8 is build 12.
- `apkUrl` must point directly to the new APK.
- `required: false` gives UPDATE NOW / LATER.
- `required: true` removes LATER and forces the update before normal use.
- `sha256` is optional. If supplied, TiviLux verifies the APK before opening Android's installer.
- Keep the Android package ID `tv.tivilux.nativeplayer` unchanged.
- Every release MUST be signed with the same signing certificate/keystore as the APK already installed on members' devices. If the signing certificate changes, Android will reject the APK as an update.

## Member flow

1. TiviLux opens normally.
2. A tiny `latest.json` request checks the newest build.
3. If a newer `versionCode` exists, the TV-safe update popup appears.
4. UPDATE NOW downloads the APK inside TiviLux.
5. The first time on Android 8+, Android may ask the member to allow TiviLux to install unknown apps.
6. TiviLux automatically continues when the member returns.
7. Android shows its normal Update/Install confirmation.
8. The new APK installs over the existing app; TiviLux login/settings/cache remain intact.
