I'm using go_router to handle all of my routes and navigation in my flutter app
This is my router defined
static GoRouter router = GoRouter(
navigatorKey: StateService.navigatorKey,
routes: [
GoRoute(
path: StartPage.id,
builder: (context, state) => const StartPage(),
),
GoRoute(
path: FirstPage.id,
builder: (context, state) => const FirstPage(),
),
GoRoute(
path: SecondPage.id,
builder: (context, state) => const SecondPage(),
),
GoRoute(
path: ThirdPage.id,
builder: (context, state) => const ThirdPage(),
),
],
);
I've also set up deep linking in my manifest.xml file as follows :
<meta-data
android:name="flutter_deeplinking_enabled"
android:value="true" />
<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="http"
android:host="link-tester-flutter.web.app"
android:pathPattern="/*" />
<data android:scheme="https"
android:host="link-tester-flutter.web.app"
android:pathPattern="/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The problem is that my deep link does not open inside my app. It always opens in the browser.
I tried two different testing scenarios first I tested my deep link in the simulator using the following command
adb shell 'am start -a android.intent.action.VIEW \
-c android.intent.category.BROWSABLE \
-d "https://link-tester-flutter.web.app/second-page"' \
com.example.dynamic_links
I then disabled/uninstalled my web browser on my android device and that way whenever I open url it opens it inside the app. I am very close to making this work as my links are indeed working. what am I doing wrong here? why do they always open in browser and not in the app?
Note : A flutter web version of this app has been hosted on firebase and I have indeed included the assetlinks.json file.