Etar-Group / Etar-Calendar

Android open source calendar
https://f-droid.org/packages/ws.xsoh.etar/
GNU General Public License v3.0
2.07k stars 393 forks source link

Permission "FOREGROUND_SERVICE_DATA_SYNC" #1720

Closed Gitsaibot closed 1 month ago

Gitsaibot commented 3 months ago

There are problems with google release manager:

Your app uses the FOREGROUND_SERVICE_DATA_SYNC permission. You can only use this permission if your app performs tasks noticeable to the user when they're not directly interacting with your app.

Provide a video demonstrating how your app uses the FOREGROUND_SERVICE_DATA_SYNC permission for the tasks you've selected

@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.

woheller69 commented 3 months ago

Maybe FOREGROUND_SERVICE_TYPE_MANIFEST would be sufficient for below Android 14

theimpulson commented 2 months ago

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.

jspricke commented 2 months ago

@theimpulson do you have details what to switch to?

woheller69 commented 2 months ago

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);
    }
theimpulson commented 2 months ago

ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST

Where is this type documented and what it does?

woheller69 commented 2 months ago

just read the link above

theimpulson commented 2 months ago

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.

Gitsaibot commented 2 months ago

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.