Reputation: 493
How to open native mail on android device using react native.
I currently am using Linking.openURL()
but that only works for iOS.
I am trying to open native mail on android device using React Native. I currently am using Linking.openURL(url)
and this works no problem for iOS devices but does not work for android devices.
Please advise if you can. Much appreciated.
Upvotes: 0
Views: 723
Reputation: 493
I fixed this by going into the android.manifest.xml and added the following intent, this allows me to open email on android. hope it helps someone!
<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>
answer was found here android intent-filter to listen for sent email addresses?
Upvotes: 1