Giter VIP home page Giter VIP logo

Comments (5)

nkalupahana avatar nkalupahana commented on July 3, 2024

These are only deprecated for now, and based on the distribution of Android versions and on how long these permissions have been around, it will likely be many years until they're removed. We support the current system for newer versions of Android. If things change, we will be sure to update the plugin as needed.

from media.

davideramoaxa avatar davideramoaxa commented on July 3, 2024

Hi @nkalupahana, I think this issue should be reopened.
I explain why:

Here

public void getAlbums(PluginCall call) {
        Log.d("DEBUG LOG", "GET ALBUMS");
        if (isStoragePermissionGranted()) {
            Log.d("DEBUG LOG", "HAS PERMISSION");
            _getAlbums(call);
        } else {
            Log.d("DEBUG LOG", "NOT ALLOWED");
            this.bridge.saveCall(call);
            requestAllPermissions(call, "permissionCallback");
        }
    }

isStoragePermissionGranted() is checking only for permissions related to the current SDK

       @Permission(
            strings = { Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE },
            alias = "publicStorage"
        ),
        @Permission(
            strings = { Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VIDEO },
            alias = "publicStorage13Plus"
        )

I don't see the point of 'requestAllPermissions' if isStoragePermissionGranted == false.

If I'm targeting SDK 33, in my manifest I need to set android:maxSdkVersion="32" for android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE
this means that those permissions are available only if the device is running SDK <= 32

If I'm running on SDK 33:

  • those permissions are not present
  • you are properly not checking for them in the isStoragePermissionGranted
  • but if the proper permissions are not yet granted, you are requesting for all, including those not required

The problem is that in described case:

  • the first time I invoke getAlbums, after the user granted access permissions, I get an error for missing (not needed) permissions.
{nativeError: Error: Missing the following permissions in AndroidManifest.xml:
android.permission.READ_EXTERNAL_STORAGE ...
  • If I retry (the user already granted) it works without problem

Is it possible to replace requestAllPermissions with requestPermissionForAlias and request only permissionSet (alias) related to the current SDK?

from media.

jepiqueau avatar jepiqueau commented on July 3, 2024

@nkalupahana @davideramoaxa look i what i did in capacitor-video-player i use requestPermissionForAlias and that the only i found to make it working

from media.

nkalupahana avatar nkalupahana commented on July 3, 2024

@davideramoaxa I'm sorry, but I'm unable to reproduce the error you're talking about. Using the example app on an API 33 emulator, I (1) opened it, (2) clicked "Get Albums", and (3) Clicked "Allow" on the permissions prompt, and the albums on the device showed up (no need to retry). Could you provide some sort of reproduction with the example app, or let me know what needs to be modified on the example app to cause this issue? Thanks!

from media.

nkalupahana avatar nkalupahana commented on July 3, 2024

@davideramoaxa please provide a reproduction with a separate app or the example app! Otherwise, I'll be closing this issue as failed to reproduce.

from media.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.