-
Notifications
You must be signed in to change notification settings - Fork 0
Update Notification Logic
Fabian edited this page Aug 27, 2026
·
3 revisions
| Source | When it fires | Status |
|---|---|---|
ConnectivityReceiver (dynamic, registered from main.py) |
App process alive + WiFi/data connects | Instant check |
| UpdateCheckWorker (WorkManager) | Every 15 min, only when network available | Survives app kills |
Both run entirely in Java — no Python needed for the check/notify.
-
Cooldown gate —
SharedPreferences("update_checker_prefs", 0)→last_notified_timestamp. If < 7 days since last notify, skip. -
HTTP GET
https://api.github.com/.../releases/latest(10s timeout). -
Version compare — GitHub
tag_namevs installedPackageInfo.versionName. Equal → skip. -
Notify —
NotificationCompaton channelupdate_channel, id999. Tap → PendingIntent launches the app with extrasaction=open_update,version=X. -
Save timestamp —
last_notified_timestamp = now(starts the 7-day clock).
-
main.py_bind_update_intent_listener—on_new_intentfires when notification tapped while app is alive →handle_update_intent(self, intent=intent) -
update_checker.pyhandle_update_intent— readsactionextra; ifopen_update, navigates to the update screen via_navigate_to_update_screen - If app was killed, the tap's intent is picked up by
getIntent()inon_start/on_resumeinstead
-
WorkScheduler.java— holds all WorkManager logic (Constraints, PeriodicWorkRequest,enqueueUniquePeriodicWork), avoiding jnius nested-class/covariant-return issues (Constraints$Builder,PeriodicWorkRequest.Builder.build()returning baseWorkRequest). -
update_checker.pyschedule_update_check— callsWorkScheduler.scheduleUpdateCheck(context)once per launch. Work every 15 min withNetworkType.CONNECTEDconstraint.ExistingPeriodicWorkPolicy.KEEPprevents duplicates across re-launches.
-
ConnectivityReceiver.onReceivedoes no network pre-check — it goes straight to the cooldown gate. If there's no real internet, the HTTP GET fails gracefully insidefetchLatestVersion(the initialgetActiveNetworkInfo()check was removed: it falsely reported offline during the broadcast's brief transition window). - Adding a new Java class (
WorkScheduler.java) requires a full rebuild; it's not covered by the adb-push source override.
-
VERSIONtemporarily"1.0.8"so GitHub's1.0.9.1is detected as newer (needs revert) - Config Clear in the Stats screen resets
update_checker_prefsso you can re-trigger immediately
The ConnectivityReceiver check itself (the HTTP/notify part) only runs while the app's process is alive due to dynamic registration — but the WorkManager worker covers the killed-app case at 15-min granularity, which is WorkManager's floor.