打开电子邮件应用程序网址 [英] Open email app url

查看:60
本文介绍了打开电子邮件应用程序网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将链接添加到我的网站检查您的电子邮件".如果用户使用 mob 版本链接,则应在浏览器中打开邮件应用程序或电子邮件服务 URL(如果应用程序不存在).例如用户有 test@gmail.com.如果用户没有 Gmail 应用程序,链接应在浏览器中打开 gmail 应用程序或 https://mail.google.com.也许最好启动用户首选的邮件应用而不是 gmail.

I want to add link to my website "Check your email". If user is on mob version link should open mail app or email service url in browser if app is absent. For example user has test@gmail.com. Link should open gmail app or https://mail.google.com in browser if user has no gmail app. Maybe it's better to launch user preferred mail app instead of gmail.

安卓

我找到了 https://developer.chrome.com/multidevice/android/intents 意图链接意图://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end

I found https://developer.chrome.com/multidevice/android/intents whith intent link 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 或任何其他应用

It works fine but I can't understand how to do same thing with https://play.google.com/store/apps/details?id=com.google.android.gm&hl=ru or any other app

我还发现 https://developer.android.com/reference/android/content/Intent.html#ACTION_SEND 打开邮件应用程序,但 intent://send#Intent;action=android.intent.action.SEND;end 不起作用

Also I found https://developer.android.com/reference/android/content/Intent.html#ACTION_SEND to open mail app but intent://send#Intent;action=android.intent.action.SEND;end not works

谁能给我一个工作网址来打开 Gmail 应用程序或默认邮件应用程序?

Can anybody give me working url to open gmail app or default mail app?

iOs

通用链接 https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12

互联网上有很多关于如何将您的网站与您的应用相关联的文章.但是如何从我的网站启动另一个应用程序?

Internet has many articles how to link your site with your app. But how can I start another app from my site?

推荐答案

一种方法是在您的网站中添加一个链接,例如

One way to do this is to add a link in your website such as

<a href="mailto:user@domain.com?Subject=Hello%20User">Inbox me!</a>

如果您的 Android 手机上没有安装任何邮件应用程序,这将不起作用.因此,您必须安装一个可以侦听此邮件事件/意图的应用程序,例如 GMail.如果安装了两个或多个可以处理此事件/意图的应用,Android 将显示一个应用列表,询问您使用哪个应用打开链接.

This will not work if you do not have any mail app installed on your Android phone. Therefore, you must install an app that can listen to this mail event/intent such as GMail. If two or more apps are installed that can handle this event/intent, Android will show a list of apps, asking you which app to use to open the link.

接下来您要做的是将自己的 Android 应用列为可以处理邮件事件/意图的应用之一.这是接收意图的用武之地.在您的<代码中>Manifest.xml,声明您的活动如下:

The next thing you wanna do is have your own Android app listed as one of the apps that can handle mail event/intent. This is where Receiving an Intent comes in. In your Manifest.xml, declare your activity as below:

<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/意图过滤器.html

更新:

这是另一种从网页打开安卓应用程序.但要使其发挥作用,您需要具体了解邮件应用程序的收件箱活动是如何在 Manifest.xml 中声明的.如果活动声明如下:

Here is another way to Open android application from a web page. But for this to work, you need to know specifically how the Mail app's inbox activity was declared in the Manifest.xml. If the activity was declared as below:

<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>

这篇关于打开电子邮件应用程序网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆