如何使用“ React Native”和“ Linking.openURL()” iOS

时间:2019-05-03 20:34:03

标签: javascript android ios reactjs react-native

如何使用react native在android设备上打开本地邮件。 我目前正在使用Linking.openURL(),但这仅适用于iOS。

我正在尝试使用React Native在android设备上打开本机邮件。我目前正在使用Linking.openURL(url),这在iOS设备上没有问题,但在Android设备上却没有问题。

请告知是否可以。非常感谢。

1 个答案:

答案 0 :(得分:0)

我通过进入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?

找到

answer