Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

deeplink between two ionic applications not working on android 12 #261

Open
hamdipro opened this issue Jun 16, 2022 · 6 comments
Open

deeplink between two ionic applications not working on android 12 #261

hamdipro opened this issue Jun 16, 2022 · 6 comments

Comments

@hamdipro
Copy link

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.

@mreis1
Copy link

mreis1 commented Aug 1, 2022

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...

@mreis1
Copy link

mreis1 commented Aug 11, 2022

Solved by this pull request #260

@hamdipro
Copy link
Author

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.

@ipehimanshu
Copy link

hello

how did you fix this issue ?

Thanks

@hamdipro
Copy link
Author

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

@hamdipro
Copy link
Author

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

oddcb added a commit to systemfabrikken/sp-ionic-plugin-deeplinks that referenced this issue Jan 28, 2023
Får ikke gammelt oppsett til å fungere når målet er Android 12. Applinker må da heller legges til via config.xml i cordova-prosjektet på formen:

```xml
            <intent-filter android:autoVerify="true" android:label="En eller annen label">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:host="www.foo.com" />
                <data android:scheme="https" />
                <data android:pathPattern="/foo/bar?q=x" />
                <data android:pathPattern="osv." />
                <data android:pathPattern="Finnes også alternatives til pathPattern" />
            </intent-filter>
```

Se også issues i repoet:

ionic-team#260
ionic-team#261
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants