Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android Scoped Storage #244

Closed
nicoburns opened this issue Oct 5, 2020 · 5 comments
Closed

Support Android Scoped Storage #244

nicoburns opened this issue Oct 5, 2020 · 5 comments
Labels
bug Something isn't working released

Comments

@nicoburns
Copy link

It is currently necessary to add android:requestLegacyExternalStorage="true" to make images picked by the library work correctly on Android 10 (see #219). As documented here, that option will be going away in Android API level 30 (Android 11), by which point this plugin will need to have implemented the new scoped storage APIs in order to continue functioning.

@bartolkaruza bartolkaruza added the bug Something isn't working label Oct 7, 2020
@bartolkaruza
Copy link
Collaborator

#242 Happy to take PR's for this

@lon9man
Copy link

lon9man commented Apr 8, 2021

@bartolkaruza or somebody

DOCS

Starting in August 2021, new apps will need to:
...

  • Target API level 30 (Android 11) ...

...
Starting in November 2021, app updates will be required to target API level 30.
information from here: https://developer.android.com/distribute/best-practices/develop/target-sdk

PRE-HISTORY

  1. i ran your example-app with targetSdkVersion 30 on emulator
    image
  2. it works as expected (BUT i also see that it uses deprecated MediaStore's DATA-column, so it uses raw paths, which AFAIU won't work in Android 11 as announced by Google):
    a) it shows thumbnails
    b) JSON-response from method getPhotos
    i tried such paths like:
    /storage/emulated/0/Pictures
    /storage/emulated/0/PicturesX
    /storage/emulated/0/DCIM/Pictures
    /storage/emulated/0/DCIM/Pictures/PicturesX
    /storage/emulated/0/Movies
    /storage/emulated/0/Downloads
    /storage/emulated/0/Downloads/ABC
    ...

can you answer on the next questions, because i have read tons of docs/forums and sadly still don't have clear understanding:

  1. why your example still works in Android 11 emulator?

  2. cameraRoll currently makes 2 major things:
    a) queries MediaStore to get all images/videos from WHOLE storage
    WHAT will change here on Android 11?
    will it can return the same results (like all paths above) for WHOLE storage (not only scoped storage)?

    b) returns uri file://... to React Native to render thumbnail (using raw paths as i see in sources)
    WHAT will change here on Android 11?
    how React Native will can render thumbnails if raw paths will not be available due to deprecating DATA-column in MediaStore (AFAIU we will have ONLY Uri instead it). what is the alternative possible?

@mars-lan
Copy link

Looks like the deadline is May not August

Starting May 5th, you must let us know why your app requires broad storage access

We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs.

Developers with apps on devices running Android 11+ must use Scoped Storage to give users better access control over their device storage. To release your app on Android 11 or newer after May 5th, you must either:

- Update your app to use more privacy friendly best practices, such as the Storage Access Framework or Media Store API
- Update your app to declare the All files access (MANAGE_EXTERNAL_STORAGE) permission in the manifest file, and complete the All files access permission declaration in Play Console from May 5th
- Remove the All files access permission from your app entirely
For apps targeting Android 11, the requestLegacyExternalStorage flag will be ignored. You must use the All files access permission to retain broad access.

Apps requesting access to the All files access permission without a permitted use will be removed from Google Play, and you won't be able to publish updates.

@mars-lan
Copy link

Nvm, looks like there's traction in #304

bartolkaruza pushed a commit that referenced this issue Aug 23, 2022
# [5.0.0](v4.1.2...v5.0.0) (2022-08-23)

### Bug Fixes

* Remove fbjs in favor of `invariant` lib ([#367](#367)) ([a62a717](a62a717))
* update package.json React 18 ([06970d6](06970d6))

### chore

* **npm:** migrate package to new @react-native-camera-roll/camera-roll namespace ([#414](#414)) ([86f540f](86f540f))

### Features

* **all:** fix various issues and big maintenance update of the library ([#404](#404)) ([#411](#411)) BREAKING ([bc7f0fc](bc7f0fc)), closes [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393) [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393)

### BREAKING CHANGES

* **npm:** new package namespace!
* **all:** root import changed!
```
import { CameraRoll } from @react-native-community/cameraroll
instead of
import CameraRoll from @react-native-community/cameraroll
```

Co-authored-by: idrissakhi <85105624+idrissakhi@users.noreply.github.com>
bartolkaruza pushed a commit that referenced this issue Aug 23, 2022
# [5.0.0](v4.1.2...v5.0.0) (2022-08-23)

### Bug Fixes

* Remove fbjs in favor of `invariant` lib ([#367](#367)) ([a62a717](a62a717))
* update package.json React 18 ([06970d6](06970d6))

### chore

* **npm:** migrate package to new @react-native-camera-roll/camera-roll namespace ([#414](#414)) ([8998fe6](8998fe6))

### Features

* **all:** fix various issues and big maintenance update of the library ([#404](#404)) ([#411](#411)) BREAKING ([bc7f0fc](bc7f0fc)), closes [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393) [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393)

### BREAKING CHANGES

* **npm:** new package namespace!
* **all:** root import changed!
```
import { CameraRoll } from @react-native-community/cameraroll
instead of
import CameraRoll from @react-native-community/cameraroll
```

Co-authored-by: idrissakhi <85105624+idrissakhi@users.noreply.github.com>
bartolkaruza added a commit that referenced this issue Aug 23, 2022
…ry (#404) (#411) BREAKING

Fixes
fix(ci): fixed android release build as a CI test step

fix(android): Fix MediaStore issues and support scopped storage #322 #244

fix(android): Fix saveImageToCameraRoll #248 #254

fix(android): remove JCenter #340 #401

fix(ios): Fix performance issues #276

fix(ios): add method to get file Path from internal PH ID #135

fix(react-native): Bump used dependencies #393 ...

Fixes #322
Fixes #244
Fixes #248
Fixes #254
Fixes #340
Fixes #401
Fixes #276
Fixes #135
Fixes #393

new Features

feat(ios): now it's possible to listen to library selection changes
`useEffect(() => {
let subscription: EmitterSubscription;
if (isAboveIOS14) {
subscription = cameraRollEventEmitter.addListener('onLibrarySelectionChange', (_event) => {
getUnloadedPictures();
});
}

return () => {
if (isAboveIOS14 && subscription) {
subscription.remove();
}
};`

feat(ios): possibility to open native modal to update selection when authorization is limited
iosRefreshGallerySelection()
feat(ios): Convert HEIC images on demand to upload to server
BREAKING CHANGE: root import changed!
```
import { CameraRoll } from @react-native-community/cameraroll
instead of
import CameraRoll from @react-native-community/cameraroll
```

Co-authored-by: idrissakhi <85105624+idrissakhi@users.noreply.github.com>
bartolkaruza pushed a commit that referenced this issue Aug 23, 2022
# [5.0.0](v4.1.2...v5.0.0) (2022-08-23)

### Bug Fixes

* Remove fbjs in favor of `invariant` lib ([#367](#367)) ([a62a717](a62a717))
* update package.json React 18 ([06970d6](06970d6))

### chore

* **npm:** migrate package to new @react-native-camera-roll/camera-roll namespace ([#415](#415)) ([aa40431](aa40431))

### Features

* **all:** fix various issues and big maintenance update of the library ([#404](#404)) ([#411](#411)) BREAKING ([c230dd0](c230dd0)), closes [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393) [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393)

### BREAKING CHANGES

* **npm:** new package namespace!
* **all:** root import changed!
```
import { CameraRoll } from @react-native-community/cameraroll
instead of
import CameraRoll from @react-native-community/cameraroll
```

Co-authored-by: idrissakhi <85105624+idrissakhi@users.noreply.github.com>
bartolkaruza pushed a commit that referenced this issue Aug 23, 2022
# [5.0.0](v4.1.2...v5.0.0) (2022-08-23)

### Bug Fixes

* Remove fbjs in favor of `invariant` lib ([#367](#367)) ([a62a717](a62a717))
* update package.json React 18 ([06970d6](06970d6))

### chore

* **npm:** migrate package to new @react-native-camera-roll/camera-roll namespace ([#416](#416)) ([6afa303](6afa303))

### Features

* **all:** fix various issues and big maintenance update of the library ([#404](#404)) ([#411](#411)) BREAKING ([c230dd0](c230dd0)), closes [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393) [#322](#322) [#244](#244) [#248](#248) [#254](#254) [#340](#340) [#401](#401) [#276](#276) [#135](#135) [#393](#393)

### BREAKING CHANGES

* **npm:** new package namespace!
* **all:** root import changed!
```
import { CameraRoll } from @react-native-community/cameraroll
instead of
import CameraRoll from @react-native-community/cameraroll
```

Co-authored-by: idrissakhi <85105624+idrissakhi@users.noreply.github.com>
@bartolkaruza
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

4 participants