-
Notifications
You must be signed in to change notification settings - Fork 25
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 for Content scheme URIs for Android #62
Comments
Sounds like it could be a good feature to add. I don't really have time to look into this atm, but if you want to do a pr, context is now injected into I believe it could be implemented as a new type of fetcher: Basically Also, fyi Fetcher is an interface you can implement in your own app and add to your own In some cases on android your could probably just accomplish this as well with a mapper... if you can actually get a real file path from |
Content URIs (
android.net.Uri
) do not work on Android (tested on Android 13). I also tried to convertandroid.net.Uri
to a string then back tojava.net.Uri
, that doesn't work either. I believe this has not been implemented yet, probably because Content URIs requireContext
.Typically, the Content URI is used to retrieve a bitmap like this (which as you can see, uses a
Context
) :I haven't dived into Kamel's source code, so I know little to none about how everything is implemented. However, in
Compose multiplatform
, the API exposes aImageBitmap
which is platform-agnostic. On Android side, we can useBitmap.asimageBitmap()
extension function to convert an Android'sBitmap
into Compose ImageBitmap.In
androidMain
, we can also retrieve aContext
usingLocalContext.current
.In a Compose multiplatform app, I encountered the use-case where i have to use a KamelImage to show data from an Uri, but that Uri can either be an Uri that points to a Content scheme URI if I am on Android, or a remote URI if I am on iOS.
The text was updated successfully, but these errors were encountered: