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 [email protected]. 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.
Android
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
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
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
Can anybody give me working url to open gmail app or default mail app?
iOs
Universal links 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?
Go to Google Play and search for your app by name. Once you find your app, click on it to be taken to the App Profile. This is where you will see your App download URL.
From the Home screen, tap the Apps icon (in the QuickTap bar) > the Apps tab (if necessary) > Email or tap the Email icon directly from the Home screen. The first time you open the Email app, a setup wizard opens to help you add an email account.
In the browser, the user can click on the link and it will open up their default email client. In this example, when I click on the link it opens up my Mail app and the email address is already populated in the to field.
Android App Links are HTTP URLs that bring users directly to specific content in your Android app. Android App Links can drive more traffic to your app, help you discover which app content is used most, and make it easier for users to share and find content in an installed app.
One way to do this is to add a link in your website such as
<a href="mailto:[email protected]?Subject=Hello%20User">Inbox me!</a>
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.
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>
Reference: https://developer.android.com/guide/components/intents-filters.html
UPDATE:
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>
You can should write your URL as
<a href="intent://my_host#Intent;scheme=my_scheme;action=android.intent.action.VIEW;end">
Go to Mail!
</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With