Complete the code to declare an intent filter for a deep link in AndroidManifest.xml.
<intent-filter>
<action android:name="[1]" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>The action android.intent.action.VIEW is used to handle deep links in Android.
Complete the code to specify the scheme for a deep link in the intent filter.
<data android:scheme="[1]" />
The http scheme is commonly used for web deep links.
Fix the error in the Kotlin code to handle the deep link intent in an Activity.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val intent = [1]
val data = intent?.data
if (data != null) {
// Handle the deep link
}
}In Kotlin, the current intent is accessed via the intent property, not getIntent().
Fill both blanks to declare a deep link intent filter with host and path prefix.
<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="https" android:host="[1]" android:pathPrefix="[2]" />
</intent-filter>The host should be the domain without www for consistency, and pathPrefix defines the starting path segment.
Fill all three blanks to create a Kotlin function that extracts a query parameter named 'id' from a deep link Uri.
fun getIdFromDeepLink(intent: Intent): String? {
val data = intent.data
return data?.[1]("[2]") ?: [3]
}The Uri method getQueryParameter retrieves the value of a query parameter by name. If the parameter is missing, returning null is appropriate.