Back to special use

This commit is contained in:
Philipp Heckel 2025-09-17 17:00:40 -04:00
parent 5917c96dbf
commit 2d4b561e63
4 changed files with 9 additions and 5 deletions

View file

@ -18,8 +18,8 @@ android {
minSdkVersion 21
targetSdkVersion 35
versionCode 37
versionName "1.17.4"
versionCode 38
versionName "1.17.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View file

@ -4,7 +4,7 @@
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <!-- For instant delivery foregrounds service -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING"/> <!-- For instant delivery foregrounds service on SDK >= 34 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/> <!-- For instant delivery foregrounds service on SDK >= 34 -->
<uses-permission android:name="android.permission.WAKE_LOCK"/> <!-- To keep foreground service awake; soon not needed anymore -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <!-- To restart service on reboot -->
<uses-permission android:name="android.permission.VIBRATE"/> <!-- Incoming notifications should be able to vibrate the phone -->
@ -97,7 +97,11 @@
<!-- Subscriber foreground service for hosts other than ntfy.sh -->
<service
android:name=".service.SubscriberService"
android:foregroundServiceType="remoteMessaging"/>
android:foregroundServiceType="specialUse">
<property
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="This is the main feature of this application. The foreground notification displays the connectivity status to the configurable remote server and the service notifies the user when a new message has been published on the remote server." />
</service>
<!-- Subscriber service restart on reboot -->
<receiver

View file

@ -100,7 +100,7 @@ class SubscriberService : Service() {
serviceNotification = createNotification(title, text)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(NOTIFICATION_SERVICE_ID, serviceNotification!!, ServiceInfo.FOREGROUND_SERVICE_TYPE_REMOTE_MESSAGING)
startForeground(NOTIFICATION_SERVICE_ID, serviceNotification!!, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else {
startForeground(NOTIFICATION_SERVICE_ID, serviceNotification)
}