mailto: links not opening mail app on Android in c

2019-03-17 12:19发布

This is driving me crazy. I'm working on a Ionic app (Cordova, Angular etc). I have a contact us link which contains a mailto: href

href="mailto:info@somedomain.net?subject=my%20App"

I've read countless posts on SO that say you have to remove

<access origin="*"/>

from the config.xml in the project root and replace it with:

<access origin="mailto:*" launch-external="true" />

Which I've done. When I run ionic build it gets added to the config.xml in platforms/android/res/xml. But no matter what I do the link doesn't open the mail app on any Android simulator (even when email is configured in the simulator).

Sadly I don't have a device to test on - so is this just a emulator thing or am I missing something?

7条回答
对你真心纯属浪费
2楼-- · 2019-03-17 13:00

Just in addition to use Cordova's WhiteListPlugin ;

It worked for me in this way: in config.xml

<access origin="*"/>
<access origin="mailto:*" launch-external="true" />
<allow-intent href="mailto:*" launch-external="yes"/>

And specially for ios add :

<platform name="ios">
    <allow-navigation href="mailto:*" launch-external="yes"/>    
    ...
 <platform name="ios">
查看更多
登录 后发表回答