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

Implement disposeIdentifier method #19

Merged
merged 1 commit into from
Apr 14, 2021
Merged

Implement disposeIdentifier method #19

merged 1 commit into from
Apr 14, 2021

Conversation

amake
Copy link
Contributor

@amake amake commented Apr 11, 2021

On Android there is a limit to the number of persistable URIs an app is allowed to have at once.

Apparently in Android 11 you can have up to 512, but before that it was only 128 (source).

It would be good to have a dispose method to allow removing unneeded URIs thus avoiding the limit.

I couldn't find any equivalent on iOS, so the implementation there is a noop.

@hpoul
Copy link
Owner

hpoul commented Apr 14, 2021

I didn't realize they were limited, good to know. thanks.
Do you think it would make sense to also implement some sort of countIdentifiers, getIdentifiers or clearIdentifiers? 🤔️ in case users lose track of them..

@hpoul hpoul merged commit 3b89a99 into hpoul:master Apr 14, 2021
@amake amake deleted the dispose branch April 14, 2021 14:13
@amake
Copy link
Contributor Author

amake commented Apr 14, 2021

Do you think it would make sense to also implement some sort of countIdentifiers, getIdentifiers or clearIdentifiers? 🤔️ in case users lose track of them..

Yes, I do think something along those lines would be reasonable.

There is an API on Android for obtaining the persisted identifiers your app has obtained: ContentResolver#getPersistedUriPermissions. This would allow implementing a method like getPersistedIdentifiers.

However I don't think such a thing exists on iOS. So for iOS the result would have to be null or empty, and that seems like a problem to me. I think it would create confusion: users might expect that they should be able to obtain a list of persisted identifiers at any time, without doing the bookkeeping themselves.

Instead I think clearPersistedIdentifiers would be better. On iOS it would be a noop; on Android it would call ContentResolver#getPersistedUriPermissions and immediately releasePersistableUriPermission.

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

Successfully merging this pull request may close these issues.

2 participants