如何将图像从 android 库发送到本机应用程序? [英] How to send image from android gallery to react-native app?
本文介绍了如何将图像从 android 库发送到本机应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将 android 库中的图像分享到 react-native 应用程序?
How do i share an image from android gallery to react-native app?
我在 AndroidManifest.xml 中添加了一个意图过滤器:
I've added an intent-filter to my AndroidManifest.xml:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
如何监听发送意图?
我想将图片从本机图片库发送到我的 react-native 应用,例如将图片从图库分享到 Instagram 应用.
I want to send an image from native image gallery to my react-native app, like sharing an image from gallery to instagram app.
推荐答案
目前没有内置方法来处理这个问题.所以我自己写了一个简单的原生 android 模块.
There is currently no builtin method to handle this. So i wrote a simple native android module by my own.
终于找到了一个支持ios和android的扩展.
Finally i found an extension which supports ios and android.
https://github.com/alinz/react-native-share-extension
这篇关于如何将图像从 android 库发送到本机应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文