binwiederhier / ntfy-android

Android app for ntfy.sh
Apache License 2.0
539 stars 112 forks source link

Unrestricted battery usage should be requested even without registrations #95

Open p1gp1g opened 2 weeks ago

p1gp1g commented 2 weeks ago

If a user uses ntfy as a UnifiedPush distributor, the first registration will be received while ntfy is in background.

When an application is in the background, it cannot start a foreground service, unless the application has unrestricted battery usage rights.

Therefore, ntfy can't start the foreground service until it is opened again after the registration.

To fix that issue, this permission should be granted before receiving the first registration.


BTW, you can ask to ignore battery optimization for a package without asking users to go to the settings that way : https://codeberg.org/NextPush/nextpush-android/src/tag/1.9.0/app/src/main/java/org/unifiedpush/distributor/nextpush/activities/MainActivity.kt#L120