fix(push): hold the ntfy connection as specialUse and restart it on boot #62
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/push-special-use"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 1 of M8's order from here (docs#390,
PLAN.mdM8, decided by the org lead 2026-10-29).Why
PushServicewas adataSyncforeground service. Android 15 stopsdataSyncafter six hours a day and expects the service to stop itself inonTimeout. Ours never did, so onedge(target 36) the app would crash once the limit was reached. A held-open push connection isn't a transfer either, and transfers are what Play reservesdataSyncfor.What
specialUseforeground type, with thePROPERTY_SPECIAL_USE_FGS_SUBTYPEreason that Play reviews. This is the same approach ntfy takes on Play, and the type has no daily limit. The permission is nowFOREGROUND_SERVICE_SPECIAL_USEinstead of…_DATA_SYNC.PushBootReceiver(not exported) restarts push afterBOOT_COMPLETEDandMY_PACKAGE_REPLACED, but only if push was on and a registration is still saved. A sign-out clears the registration. The receiver starts the service from the saved topic and doesn't re-register, because the network often isn't up at boot. The stream client's backoff covers the wait.PushBootReceiverTest: 5 JVM tests for when it restarts and when it doesn't.Checked
./gradlew testDebugUnitTest lintDebug assembleDebug: BUILD SUCCESSFUL.Walked on the
s22_ultraemulator (API 35) against a local website whose push relay was set tohttps://ntfy.sh. I signed in as a throwaway admin and turned on news push.dumpsys:PushService isForeground=true types=0x40000000(specialUse).push_messages.adb reboot, with the app not opened, the service was back as specialUse, and a tickle still arrived.adb install -r(an update), the service was back with a new record.Not checked: Play's review of the declaration. That needs the video, which I'll record on the emulator for the console.
AI-assisted (Claude Code)
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY