ionic-team / ionic-plugin-deeplinks

Handle deeplinks into your Ionic/Cordova apps from Universal Links, App Links, and Custom URL schemes. For those using Ionic 2, there are some nice goodies that make life easier.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deeplink between two ionic applications not working on android 12

hamdipro opened this issue · comments

After generation of my two ionic applications using ionic-plugin-deeplinks the apk working on Android8, 9 and 11 but the deeplink is not working on android 12.

ionic-pugin-deeplinks : 1.0.24
using Branch.io as link provider.
building with :
cordova 8.0.0
android 8.0.0

I've tried to use the branch skd also but got the same issue on android 12.

Thanks for your help.

commented

I'm having the same issue but I still don't have a working solution but I'll share what I found until now relating to this issue.

According to Android:

Note: On Android 11 (API level 30) and lower, the system doesn't verify your app as a default handler unless it finds a matching Digital Asset Links file for all hosts that you define in the manifest.

More info here: https://developer.android.com/training/app-links/verify-site-associations#manual-verification

And in stack overflow, I found a question that relates to our problem but after checking the plugin source code I noticed that the strategy is already implemented.
https://stackoverflow.com/a/71139599/1084568

For reference, here's my AndroidManifest.xml (part of it)

        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTask" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <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="myapp" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:host="myappsite.com" android:pathPrefix="/" android:scheme="https" />
                <data android:host=" " android:pathPrefix="/" android:scheme=" " />
                <data android:host=" " android:pathPrefix="/" android:scheme=" " />
                <data android:host=" " android:pathPrefix="/" android:scheme=" " />
                <data android:host=" " android:pathPrefix="/" android:scheme=" " />
            </intent-filter>
        </activity>

AutoVerify is already enabled and Domain is correctly declared.

In the end, no verified links detected for my app as you can see in the image below.

image

"Links to open this app: 0 verified links"

Workaround

Clicking the "Add link button" will bring the links we declared and if we select the domain , everything will start working but we don't want our app users to do this, ofc...

commented

Solved by this pull request #260

Thanks for your reply @mreis1
I tried to patch the plugin with your fix but didn't work, what are your params for plugin install ?

Also i tried to check the APK manually : https://developer.android.com/training/app-links/verify-site-associations#manual-verification

but i got legacy_failure error.

hello

how did you fix this issue ?

Thanks

fixed for me by patching the plugin :
i've changed in the plugin.xml file the config-file /activity part by this snippet (version used 1.0.22 ) :

    <config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="$DEEPLINK_SCHEME" />
        <data  android:host="$DEEPLINK_HOST"/>
      </intent-filter>
    </config-file>

After that i have to delete platform and re-add it to generate platform android with the patched plugin.

You can use hooks or scripts to automate this patch.

Hope that helps

@mreis1, when building the application with target level 32, it doesn't work again your MR.