Skip to content

Latest commit

 

History

History
59 lines (46 loc) · 2.24 KB

README_android.md

File metadata and controls

59 lines (46 loc) · 2.24 KB

Android

Google documentation:

SETUP

Disable default Flutter deep linking:

From Flutter 3.24, you must disable it explicitly.

  1. Navigate to android/app/src/main/AndroidManifest.xml file.
  2. Add the following metadata tag and intent filter inside the tag with .MainActivity
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />

Add your setup:

<!-- App Link sample -->
<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="https" android:host="www.example.com" android:pathPrefix="/foo" />
</intent-filter>

<!-- Deep Link sample -->
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Add optional android:host to distinguish your app
          from others in case of conflicting scheme name -->
    <data android:scheme="sample" android:host="open.my.app" />
    <!-- <data android:scheme="sample" /> -->
</intent-filter>

ProGuard rules

When using ProGuard, those additional rules are added
https://github.com/llfbandit/app_links/blob/master/app_links/android/proguard.txt

Testing

adb shell am start -a android.intent.action.VIEW \
  -d "sample://open.my.app/#/book/hello-world"

When using ADB for testing, all special characters have to be escaped. More info.

For App Links, you can also test it from Android Studio: Documentation.

Android 13 and beyond:

  • While in development, you may need to manually activate your links.
  • Go to your app info/settings: Open by default > Add link > (your links should be already filled).