我想添加指向我的网站的链接“检查您的电子邮件”。如果用户使用的是 mob 版本链接,则应在浏览器中打开邮件应用程序或电子邮件服务 url(如果应用程序不存在)。 例如用户有 test@gmail.com。链接应打开 gmail 应用程序或 https://mail.google.com如果用户没有 gmail 应用程序,则在浏览器中。也许启动用户首选的邮件应用程序而不是 gmail 更好。
安卓
我找到了 https://developer.chrome.com/multidevice/android/intents Intent 链接 intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end
它工作正常,但我不明白如何用 https://play.google.com/store/apps/details?id=com.google.android.gm&hl=ru 做同样的事情或任何其他应用
我还找到了https://developer.android.com/reference/android/content/Intent.html#ACTION_SEND打开邮件应用程序但 intent://send#Intent;action=android.intent.action.SEND;end 不起作用
任何人都可以给我打开 gmail 应用程序或默认邮件应用程序的工作 url 吗?
iOs
互联网上有很多文章如何将您的网站与您的应用程序链接起来。但是如何从我的站点启动另一个应用程序?
最佳答案
一种方法是在您的网站中添加一个链接,例如
<a href="mailto:user@domain.com?Subject=Hello%20User">Inbox me!</a>
如果您的 Android 手机上没有安装任何邮件应用程序,这将不起作用。因此,您必须安装一个可以监听此邮件事件/Intent 的应用程序,例如 GMail。如果安装了两个或更多可以处理此事件/Intent 的应用程序,Android 将显示一个应用程序列表,询问您使用哪个应用程序打开链接。
您接下来要做的是将您自己的 Android 应用程序列为可以处理邮件事件/Intent 的应用程序之一。这是Receiving an Intent的地方进来。在您的 Manifest.xml
中,声明您的 Activity 如下:
<activity android:name="EmailHandlerActivity">
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="mailto" />
</intent-filter>
</activity>
引用:https://developer.android.com/guide/components/intents-filters.html
更新:
这是 Open android application from a web page 的另一种方式.但要使其正常工作,您需要具体了解邮件应用程序的收件箱 Activity 是如何在 Manifest.xml
中声明的。如果 Activity 声明如下:
<activity android:name="InboxActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="my_scheme" android:host="my_host" />
</intent-filter>
</activity>
你可以把你的网址写成
<a href="intent://my_host#Intent;scheme=my_scheme;action=android.intent.action.VIEW;end">
Go to Mail!
</a>
关于android - 打开电子邮件应用程序网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45836834/