Repository navigation
Unable to specify PROPERTY_SPECIAL_USE_FGS_SUBTYPE via Service Attribute #8729
Copy link
Copy link
Closed
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).Issues with the Android API binding (Mono.Android.dll).enhancementProposed change to current functionality.Proposed change to current functionality.
Milestone
Description
Activity
- addedArea: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.needs-triageIssues that need to be assigned.Issues that need to be assigned.
on Feb 16, 2024 - removedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Feb 16, 2024 Related: https://developer.android.com/guide/topics/manifest/property-element
We should probably introduce a
PropertyAttribute, which emits<property/>within the appropriate scope:[AttributeUsage (AttributeTargets.Class, AllowMultiple=true)] public partial class PropertyAttribute : Attribute { public PropertyAttribute (string name); public string Resource {get; set;} public string Value {get; set;} }
which would allow:
[Service] [Property ("android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE", Value="Explanation")] partial class FocusSessionService : Service { }
Open design question: from the
<property/>docs:Note: A
<property>tag should not contain bothandroid:valueandandroid:resourceattributes. If that happens,android:resourceis preferred.Given this, it might instead be better to have
PropertyResourceAttributeandPropertyValueAttributeinstead of a singlePropertyAttribute.- addedenhancementProposed change to current functionality.Proposed change to current functionality.
on Apr 17, 2024 - addedArea: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).Issues with the Android API binding (Mono.Android.dll).
on Apr 23, 2024 - added a commit that references this issue
on Jun 7, 2024 - added a commit that references this issue
on Jul 10, 2024 - locked and limited conversation to collaborators
on Aug 10, 2024
Metadata
Metadata
Assignees
Labels
Area: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).Issues with the Android API binding (Mono.Android.dll).enhancementProposed change to current functionality.Proposed change to current functionality.
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_USEpermission 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_SUBTYPEfor "special use" via an attribute: https://developer.android.com/about/versions/14/changes/fgs-types-required#special-useDid 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