Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deep link doesn't open Flutter Android App

I am trying to use Deep link (with uni_links plugin) on Flutter Android App.

AndroidManifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:label="concrete_sensors"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">

            <!-- !Deep Links -->
            <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" />
                <!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
                <data
                    android:scheme="https"
                    android:host="cloud.appwrite.io" />
            </intent-filter>
            <!-- !Deep Links -->

            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

            </activity>
        
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

what i am doing wrong in AndroidManifest file?

The app is opened by the link "https://cloud.appwrite.io/...." only if I manually turn on Settings/Apps/Open by default/Open supported links on a mobile.

like image 318
GG2022 Avatar asked Oct 25 '25 05:10

GG2022


1 Answers

Deep links on Android 12+ require you to declare website associations via an assetlinks.json file located at https://your.host.name/.well-known/assetlinks.json. It should looks something like this:

[
   {
      "relation":[
         "delegate_permission/common.handle_all_urls"
      ],
      "target":{
         "namespace":"android_app",
         "package_name":"com.example.app",
         "sha256_cert_fingerprints":[
            "14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"
         ]
      }
   },
]

To find the sha256 fingerprint for your app go to the Google Play Console, select the relevant app, and select App signing under setup in the left sidebar. Look for a section called Digital Asset Links JSON.

Having the assetlinks.json file up to date will allow deeplinking from your web app on all installs from the Play Store.

If you are debugging, you will need to follow the steps you mentioned (go app settings > set as default > supported web addresses and toggle on the deeplink host) or generate a sha256 fingerprint specific to your development environment.

More on this here: https://developer.android.com/training/app-links/verify-android-applinks#web-assoc

like image 168
rhpekarek Avatar answered Oct 26 '25 20:10

rhpekarek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!