javascript - 如何使用 React Native 在 Android 设备上打开本机邮件,就像使用 'Linking.openURL()' iOS 完成的一样
问题描述
如何使用 react native 在 android 设备上打开本机邮件。我目前正在使用Linking.openURL()
,但这仅适用于 iOS。
我正在尝试使用 React Native 在 android 设备上打开本机邮件。我目前正在使用Linking.openURL(url)
,这对 iOS 设备没有问题,但不适用于 android 设备。
可以的话请指教。非常感激。
解决方案
我通过进入 android.manifest.xml 解决了这个问题,并添加了以下意图,这允许我在 android 上打开电子邮件。希望它可以帮助某人!
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
在这里找到了答案android intent-filter to listen for sent email addresses?
推荐阅读
- python - Pandas Lookup 将被弃用 - 优雅而高效的替代方案
- laravel - 如何在 laravel 中链接 Bus::chain()
- css - font-family suggestion in Chrome devtools is commercial-free or not?
- aws-sdk - 纱线添加@aws-sdk/client-dynamodb
- android - 如何实现具有不同类型项目(TextView、Button、Spinner)的通用 RecyclerView?
- python - 带有 VIEW 语句的 Django SUM 查询
- android - 如何在约束布局内同时应用左右约束时将布局左对齐?
- javascript - Mongoose Express.js 从多个查询中获取结果
- swift - 如何使按钮每次按下时显示不同的标签
- git - 将 rsync 用于数据和 Git 用于代码