I receive the weekly Pinterest newsletter. When I click on an image or the Available on Google Play logo inside, a built-in popup comes up on my phone offering me to open the link with Chrome or Pinterest. The key here is the Pinterest app. On my laptop it brings up a pinterest.com link.
So I was working on our newsletter and decided to do this. All I did was to set the google play link of our app in the <a href />
section, but it opens Google Play instead of offering me the option to open the app on my phone.
<a href="https://play.google.com/store/apps/details?id=com.app.app"><img src="http://www.website.com/mylogo.png" width="100" height="35"/></a>
How can I do this?
SOLUTION
I would like to answer this question for those who don't understand how it works, like me, but unfortunately stackoverflow doesn't let me do it.
This is what I did:
Manifest:
<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="http" android:host="yolify.net"
android:pathPrefix="/"/>
</intent-filter>
Link:
<a href="http://yolify.net">LINK</a>
Your website (just before the </head>
tag)
<script>
if (screen.width <= 1080) {
document.location = "https://play.google.com/store/apps/details?id=com.yolify.android";
}
</script>
What's happening here?
- You point your link to your website, not your google play URL.
- In the manifest you set your app to listen to links pointing to your website.
- You send your mobile users to the Google Play URL, but this only happens when they don't have your app on their phones. Otherwise, your browser will offer you to open your app from the email.
I would like to highlight that even though there are about 5 similar questions on stackoverflow, none of them gives a real explanation on the background. I hope I could help others suffering with this question.