Android deep link using intent not opening app
Asked Answered
D

4

5

I am trying to open an app that I made from mobile chrome browser.

https://developer.chrome.com/multidevice/android/intents

From this link, I figured that I must use the "intent:" syntax to do the job.

However, my app doesn't open. Instead, it opens the Google Play Store, but the store just shows the "item not found" page.

I would love to know if I'm doing anything wrong.

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="myscheme" android:host="myhost" android:path="/"/>
        </intent-filter>

This is the intent filter that I wrote.

var androidIntentUrl = 'intent://myhost/#Intent;scheme=myscheme;package=my.test.app.package;end';

if(!isIOS && isChromeAndBiggerThanVer25()) {
        location.href = androidIntentUrl;
}

And this is what I wrote on the web.

Must the app be released on Play Store to make this happen?

I don't quite understand the whole stuff yet.

I want to know what's wrong.

PS) The names "myscheme" and "myhost" are just names that I made up for writing this question. The actual names in my code match those written in my project settings and all, including the package name.

Droplight answered 18/12, 2018 at 15:37 Comment(3)
Did you try a link like <a href="myscheme://myhost/some/other/parameters"> ? I think you need to use your defined schema (myscheme in your case) instead of intent://Pinnatipartite
@Pinnatipartite Thanks for the suggestion. However, the official documentation (the link I wrote) states that if one is using Android Chrome browser with a version higher than 25 must use the intent syntax. I'll try it anyway though. Thanks.Droplight
@Pinnatipartite Wow It worked! Thank you!Droplight
D
7

As Alexey commented on my post,

<a href="myscheme://myhost/some/other/parameters">

worked just okay for me.

I double checked the official document (the link on my post) and my chrome version (which is 71), so I have no idea why the intent:// syntax did not work.

I guess there were changes on mobile Chrome after version 25 that I missed or couldn't find.

Droplight answered 19/12, 2018 at 7:27 Comment(0)
M
2

I just encountered the same problem where linking with Intents did not work but the direct scheme linking did. However, I didn't want to use the direct version to have a fallback redirect to the PlayStore.

The solution was that the package parameter in the intent link did not have to match the package given in the AndroidManifest.xml. I was working with a Unity project and had to use the bundle name given in the project setting.

tl;dr: this is still working in Chrome (v78), but the package parameter is not necessarily the package given in the manifest.

Manducate answered 21/11, 2019 at 10:20 Comment(1)
Where do we find the bundle name?Colorblind
R
0

The package parameter should match your application id (found in build.gradle or your AndroidManifest.xml)

The sample code above shows package as my.test.app.package, if this is not your app package name or if the app is not installed, the intent will default to the Google Play Store to search for it. Similarly, it would be best change the host and scheme parameters to something custom to your app if you haven't already.

Robespierre answered 18/12, 2018 at 15:43 Comment(2)
Oh thanks for your answer. Sadly, those are just names that I made up when I wrote the question. In my actual code, the package parameter does match the application id. Sorry that I forgot to mention it.Droplight
Oopsie! Should have figured that :PRobespierre
P
0

My answer is to open android application from web app using deep linking:

Flipkart     - <a href="flipkart://app"> Open Flipkart!  </a>
WhatsApp     - <a href="whatsapp://app"> Open WhatsApp!  </a>
Clash Royale - <a href="clashroyale://app"> Open Clash Royale!  </a>
FaceBook     - <a href="fb://app"> Open FaceBook!  </a>

If the listed application is installed in your mobile then only it will open or you have to handle the case separately.

Padriac answered 27/3, 2019 at 6:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.