Episode - 19 Setup Deep Links
Now let us start by setting up deep links on our both the platfroms. To step up the deep links in android and ios we need to add some metadata tags in respective plaforms.
Open the info.plist present under ios/Runner/ directory. This is called as property List which defines the properties of our app behaviour. This is the same file where we add User Permission when app asks permission for location or photos. This file consists of Key - Value pair data. We are going to add few key - value pair data which will enable deep Linking for iOS.
<key>FlutterDeepLinkingEnabled</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>example.com</string>
<key>CFBundleURLSchemes</key>
<array>
<string>rw_boojk</string>
</array>
</dict>
</array>
Each key is a parameter and we pass the value for that parameter, CFBundleUrlName is a unique URL that distinguishes our app from other in the same scheme. It takes domain as a value you can pass your domain or if you do not have domain flutter generally passes example.com, so can state with that.
Open AndroidManifest.xml located at android/app/src/main/AndroidManifest.xml and add the following code
<!-- Deep linking -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<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="rw_book"
android:host="example.com />
</intent-filter>
Here also we are passing key value pair to our android app. First we enabled the deep linking in flutter and later pass scheme and package id.