NeoLSN / cordova-plugin-android-permissions

This plugin is designed for supporting Android new permissions checking mechanism.
Apache License 2.0
271 stars 175 forks source link

Support Android 13 (API 33) #113

Open Houdhey opened 1 year ago

Houdhey commented 1 year ago

Android 13 is gonna be released on August. Any detail for supporting it?

Especially refering to this : https://developer.android.com/about/versions/13/behavior-changes-13

With the new permissions

<manifest ...>
    <!-- Required only if your app targets Android 13. -->
    <!-- Declare one or more the following permissions only if your app needs
    to access data that's protected by them. -->
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

    <!-- Required to maintain app compatibility. -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
                     android:maxSdkVersion="32" />
    <application ...>
        ...
    </application>
</manifest>
NeoLSN commented 1 year ago

Currently, no plan. If you have any plan to support this new feature. You can create a PR, I can help to release it.

NeilCresswell commented 1 year ago

I found your plugin to be very useful thank you, so had a go at adding the new permissions for Android 13 and have submitted a PR: https://github.com/NeoLSN/cordova-plugin-android-permissions/pull/116

As well as the permissions the OP mentioned, POST_NOTIFICATIONS is now also needed if you want to do push notifications.

NeilCresswell commented 1 year ago

@NeoLSN kindly merged in PR #116 already.

TDola commented 1 year ago

I am having some difficulty with this too.

I need to request, and check permissions, and close the app if the user rejects a permission. That's fine, but on Android 33, I have to somehow know that, if your on 33, ask for read media, if your on less than 33, ask for external storage read. If you ask for both on 33, it ignores external storage read, then tells you you don't have permission when you check for it. So how are you supposed to know what API version the phone has to know what to request?

Also, READ_MEDIA_IMAGES doesn't seem to actually work, it always returns false to the hasPermission and doesn't pop up asking for access on Android 33 Emulator. When I try on my actual Android 33 phone (Pixel 7) it just works without the need for permission. This is affecting cordova-camera gallery picker.

ghenry22 commented 1 year ago

@TDola you can use the cordova diagnostic plugin core module to check the OS version. Then make the appropriate call using a simple if statement.