24

My app used to work fine with deep links, I haven't changed anything in the app but what has seemed to change is that when freshly installing the app, in the app settings - Set as default - Supported web addresses my website url that the deep links are supposed to work off of is disabled as default, I have to enable it manually to make it work.

How can I make it install with this being enabled automatically

Jacob Jefferson
  • 241
  • 2
  • 4
  • Hi Jacob...Does this answer your question? -> https://stackoverflow.com/a/42571656/6826629 – Shreyas Sanil Jan 10 '22 at 14:15
  • I have just found the same problem. When looking at all my apps under "Supported web address" All the optional ones are disabled by default. This seems like a recent change as it was working very recently. Did you find any reason for this? @ShreyasSanil It does not appear to be an issue with the app code. I am seeing this happen with multiple apps – Alistair Prestidge Feb 16 '22 at 16:24

4 Answers4

8

This is happening due to a recent change introduced in Android 12. As per the documentation:

Starting in Android 12 (API level 31), a generic web intent resolves to an activity in your app only if your app is approved for the specific domain contained in that web intent. If your app isn't approved for the domain, the web intent resolves to the user's default browser app instead.

Before Android 12, opening generic web URLs which were added as a deep link in AndroidManifest showed a dialog to choose between the app and the browser. Starting Android 12, developers are expected to:

  1. Add android:autoVerify="true" to the web URL intents for which Android will verify if the domain is associated with the same app. These associated deeplinks are also called Android App Link.s (doc link)
  2. Declare the association between your website and your intent filters by hosting a Digital Asset Links JSON file at the following location: https://domain.name/.well-known/assetlinks.json (doc link)

After this, when the app is installed and Deep link (Android App Link) is triggered, Android will verify the association and directly open the deeplink in the app (it'll not show the app chooser dialog as well in the intent.)

Mayur Dhurpate
  • 1,112
  • 4
  • 16
  • 34
  • how to add `android:autoVerify` when I use Navigation Component and graph.xml? – user924 Sep 28 '22 at 13:55
  • the intent filter is generated automatically from the graph.xml – user924 Sep 28 '22 at 14:00
  • For those who use Google provided `{yourapp}.page.link` you need to add the sha256 (SHA-1 is not enough!) fingerprint to the Firabase Project Settings. Don't forget to add the fingerprint of the debug key too. Then visit https://{yourapp}.page.link/.well-known/assetlinks.json after ~1h to confirm. – Anatol Bivol Oct 30 '22 at 16:34
  • 1
    There is also a step 3) Don't mix scheme `https` with the custom scheme (like `myapp`) in the same . It killed App Links in our project. – Peter Knut Jan 31 '23 at 21:28
  • @PeterKnut what you mean by dont mix scheme? Can you be more specific please. – Kebab Krabby Feb 05 '23 at 17:35
  • What if I dont own the website? I have a fake url like: "https:// www.exampleee.com/?token=1239&tokenId=1234" – Cipri Feb 27 '23 at 18:39
  • @KebabKrabby If you declare both `` and `` in the same ``, then your https links won't be verified and stop working. You have to create new `` for custom scheme. – Peter Knut Mar 08 '23 at 18:19
  • @user924 just add the attr in the tag: `` – John Santos Mar 17 '23 at 11:13
3

After spending a whole day on that questions, here is my solution: For me, my apk had a different package name from that in the my-domain.com/.well-known/assetlinks.json

I found it out only after examining it with this service

My suggestion if you ran into that problem

  1. check that your .well-known has no errors using the URL (replace https://my-domain.com with your domain)

https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://my-domain.com&relation=delegate_permission/common.handle_all_urls

  1. After installing the apk, check that the deep link verification is ok by using these commands if they are not verified, they will appear with that toggle switch turn off.

3.If you still have that problem you can examine the adb logcat of your device and see the error why this verification failed.

Mez
  • 24,430
  • 14
  • 71
  • 93
amitgur
  • 407
  • 6
  • 11
0

As a work-around for those implementing Adobe Assurance or some other third-party service, you can use the following filter. If the schema isn't http/https, it should work.

            <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="sampleapp"
                    android:host="my.appname.app" />
        </intent-filter>
Alan Nelson
  • 1,129
  • 2
  • 11
  • 27
0

In our case using cordova and ionic-plugin-deeplinks, everything was seemingly set up correctly but this setting was still off by default when installing the app.

The issue turned out to be a problem with how ionic-plugin-deeplinks had added support for multiple deeplink schemes, which caused a bunch of blank <data> attributes to be added to AndroidManifest.xml when the app was built. We fixed it by forking the plugin repo and removing all but the first of the <data> attributes they had added to their plugin.xml nested in the <config-file> element, starting with scheme 2 downward (an example element is below):

<data android:scheme="$DEEPLINK_2_SCHEME" android:host="$DEEPLINK_2_HOST" android:pathPrefix="$ANDROID_2_PATH_PREFIX" />

This removed the blank <data> entries in AndroidManifest.xml on build and the issue was solved.

Loz
  • 118
  • 11