Closed
Description
Android application type
.NET Android (net7.0-android, net8.0-android, etc.)
Affected platform version
VS2022, NET8
Description
The goal is to specify a FOREGROUND_SERVICE_SPECIAL_USE
permission using a Service attribute.
This issue is a continuation of this issue: #8409, which was closed after fixing a problem that prevented the foregroundServiceType to be filled in the AndroidManifest.xml
.
The issue that remains is that is isn't possible to declare the PROPERTY_SPECIAL_USE_FGS_SUBTYPE
for "special use" via an attribute: https://developer.android.com/about/versions/14/changes/fgs-types-required#special-use
Did you find any workaround?
I was able to workaround the problem by manually adding the service tag in the AndroidManifex.xml and giving my Service an explicit name
<service android:foregroundServiceType="specialUse" android:name="my.app.MyService">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Explanation on why I am using this service type"/>
</service>
[Service(Name = "my.app.MyService")]
sealed class FocusSessionService : Service
{
}