Closed Gitsaibot closed 1 month ago
Maybe FOREGROUND_SERVICE_TYPE_MANIFEST would be sufficient for below Android 14
Apologies for the late reply as I was travelling and busy with work. I think the type was added as I couldn't find a better one for specific Android version but I think we can switch to something else.
@theimpulson do you have details what to switch to?
In my apps I use this: https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MANIFEST
if (VERSION.SDK_INT >= VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(NOTIF_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED);
} else if (VERSION.SDK_INT >= VERSION_CODES.Q) {
startForeground(NOTIF_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST);
} else {
startForeground(NOTIF_ID, notification);
}
ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST
Where is this type documented and what it does?
just read the link above
just read the link above
Thanks, missed it. I am not sure how systemExempted is going to work for older versions though as it was introduced in API 34. If it works in your experience should be fine then. Otherwise Gitsaibot's PR to drop the type for old Android version seems fine too.
As I understand it, an explicit type is only required from android 14 onwards, before that the type is optional and can also be "0"(FOREGROUND_SERVICE_TYPE_NONE) which, as far as I understand it, corresponds to the default type.
FOREGROUND_SERVICE_TYPE_NONE: The default foreground service type if not been set in manifest file.
There are problems with google release manager:
@theimpulson You have added these two permissions by specifying "foregroundServiceType dataSync | systemExempted" Do we need really both permissions or can we drop dataSync? I see no reason why we need both.