Skip to content

Expose usesPermissionFlags in UsesPermissionAttribute #10409

@ShortDevelopment

Description

@ShortDevelopment

Android framework version

net9.0-android

Affected platform version

VS 2022 17.14.11 .NET 9.0.304

Description

Since android api level >= 31 location permission is no longer required for using bluetooth apis if you strongly assert that your app doesn't derive physical location.

A developer can do so by setting usesPermissionFlags to neverForLocation:

<manifest>
    <!-- Include "neverForLocation" only if you can strongly assert that
         your app never derives physical location from Bluetooth scan results. -->
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN"
                     android:usesPermissionFlags="neverForLocation" />

    <!-- Set maxSdkVersion to 30 if you can strongly assert that, on
         Android 12 and higher, your app never derives physical location from
         Bluetooth scan results and doesn't need location access for any other
         purpose. -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
                     android:maxSdkVersion="30" />
    ...
</manifest>

Sadly, this attribute is not exposed via the UsesPermissionAttribute:

<element path="uses-permission.usesPermissionFlags" visible="false" />

Steps to Reproduce

  1. Create new project
  2. Try setting usesPermissionFlags using UsesPermissionAttribute

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

Labels

Area: Mono.AndroidIssues with the Android API binding (Mono.Android.dll).needs-triageIssues that need to be assigned.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions