derChris
derChris

Reputation: 890

Deep Linking in Flutter

According to https://flutter.dev/docs/development/ui/navigation/deep-linking

I have added the following to the AndroidManifest.xml:

        <!-- Deep linking -->
        <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="appName" android:host="com.companyName.appName" />
        </intent-filter>

opening the App deployed on a real device and connected via USB worked by calling:

adb shell am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "appName://com.companyName.appName/"

and even opening some subpages like: adb shell am start -W -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "appName://com.companyName.appName/help"

But a few questions are left:

  1. How can I open the App from another app (and not via adb)?
  2. How can I add arguments for the view to open?

Upvotes: 3

Views: 3001

Answers (1)

derChris
derChris

Reputation: 890

How can I open the App from another app (and not via adb)?

Simply by calling appName://com.companyName.appName/ unsing a link in a html-website (not working typing it into the browsers url-field)

How can I add arguments for the view to open?

I solved that by adding it at the end: appName://com.companyName.appName/PARAM1/PARAM2 and as I use

onGenerateRoute: (settings) => MyRoutes.ROUTES(settings),

in the MaterialApp I can get the params by extracting them from settings.name

Upvotes: 3

Related Questions