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

Not able to create realm database on external file storage on Android 11 and plus #5107

Closed
umarpazir11 opened this issue Dec 13, 2021 · 6 comments
Assignees

Comments

@umarpazir11
Copy link

umarpazir11 commented Dec 13, 2021

Expected results

I want to create a realm database on external storage so two apps can use one single database. So I am using scope storage for android to give permission but I can create all other files but not realm database files. only realm.lock file is there

Actual Results

E/REALM: /tmp/realm-java/realm/realm-library/src/main/cpp/realm-core/src/realm/util/file.cpp:1023: [realm-core-11.3.0] Assertion failed: r == 0 && "File::unlock()" with (r, (*__errno())) = [-1, 38]

Steps & Code to Reproduce

Using scope storage for android.

Core version

Android 11 and 12

@fealebenpae
Copy link
Member

Hey @umarpazir11,
This sounds very much like realm/realm-java#6893. I'm not very familiar with the internals myself, but it seems that Android 11 changed the permission model of working around scope storage in a way that breaks filesystem locks used by realm.

@cmelchior
Copy link
Contributor

Yes, with Android 11 scoped storage is now enforced. This means the only way for apps to share files is through the Storage Access Framework (https://developer.android.com/guide/topics/providers/document-provider). Unfortunately, there isn't a way we can support this from the native side.

The only way to use it would be to copy a file from shared storage to internal storage, use it, and then copy it back. But that is probably too restrictive for any real usage.

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jan 7, 2022
@jedelbo
Copy link
Contributor

jedelbo commented Jan 31, 2022

@cmelchior So we can close this?

@cmelchior
Copy link
Contributor

Yes

@umarpazir11
Copy link
Author

@jedelbo inside of only closing it will be better if they bring some ContentProvidor for realm database similar to android one.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jan 31, 2022
@jedelbo
Copy link
Contributor

jedelbo commented Feb 1, 2022

@cmelchior I will now close this, but I hope you have noted the comment above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants