Closed amake closed 3 years ago
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..
Do you think it would make sense to also implement some sort of
countIdentifiers
,getIdentifiers
orclearIdentifiers
? 🤔️ 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
](https://developer.android.com/reference/android/content/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
.
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.