What if a single tap could teleport your user exactly where they want inside your app?
Why Deep links in Android Kotlin? - Purpose & Use Cases
Imagine you want to share a specific page inside your app with a friend. You send them a message with instructions like "Open the app, then tap here, then scroll down to that section." It's confusing and takes too many steps.
Manually guiding users wastes time and causes frustration. People might get lost or give up. Also, coding separate navigation for every possible entry point is complicated and error-prone.
Deep links let you create special links that open your app directly to the exact screen or content. Users tap the link and jump straight there, skipping all the extra steps.
val intent = Intent(this, MainActivity::class.java)
startActivity(intent) // user must navigate manuallyval intent = Intent(Intent.ACTION_VIEW, Uri.parse("myapp://product/123")) startActivity(intent) // opens product 123 directly
Deep links make your app feel smooth and smart by taking users exactly where they want to go with one tap.
When you click a link in an email about a sale item, the app opens right to that item's page instead of just the home screen.
Manual navigation is slow and confusing for users.
Deep links provide direct access to specific app content.
This improves user experience and simplifies app navigation.
Practice
Solution
Step 1: Understand deep link functionality
Deep links allow an app to open a specific screen or content when a user clicks a URL outside the app.Step 2: Compare options with this purpose
Only To open a specific screen inside the app from an external URL describes opening a specific screen from an external URL, which matches deep link behavior.Final Answer:
To open a specific screen inside the app from an external URL -> Option AQuick Check:
Deep link purpose = open specific screen [OK]
- Confusing deep links with UI styling
- Thinking deep links change app icons
- Assuming deep links increase memory
Solution
Step 1: Identify where deep links are declared
Deep links are declared inside an element within an activity in AndroidManifest.xml.Step 2: Match options to this element
Only is used to specify deep link URL patterns and actions.Final Answer:
<intent-filter> -> Option BQuick Check:
Deep links declared in intent-filter [OK]
- Confusing activity tag with deep link declaration
- Using service or provider tags incorrectly
- Not nesting intent-filter inside activity
<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="example.com" android:pathPrefix="/profile" /> </intent-filter>
Solution
Step 1: Analyze the intent filter data attributes
The scheme is https, host is example.com, and pathPrefix is /profile, so URLs starting with https://example.com/profile will match.Step 2: Check each option against these rules
https://example.com/profile/settings matches https scheme, example.com host, and path starting with /profile. Options B (http scheme), C (wrong path), and D (wrong host) do not match.Final Answer:
https://example.com/profile/settings -> Option CQuick Check:
Match scheme, host, pathPrefix = https://example.com/profile/settings [OK]
- Ignoring scheme (http vs https)
- Confusing host names
- Not checking pathPrefix carefully
<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.LAUNCHER" /> <data android:scheme="myapp" /> </intent-filter>
Solution
Step 1: Check required categories for deep links
Deep links require the BROWSABLE category to allow opening from browsers or external apps.Step 2: Identify incorrect category usage
This intent filter uses LAUNCHER category, which is for app launchers, not deep links.Final Answer:
It uses LAUNCHER category instead of BROWSABLE -> Option AQuick Check:
Deep links need BROWSABLE category [OK]
- Using LAUNCHER category for deep links
- Forgetting to add BROWSABLE category
- Placing intent-filter inside wrong tag
myapp://user/123 is clicked. Which intent filter correctly handles this deep link?Solution
Step 1: Check required action and categories for deep links
Deep links need action VIEW and categories DEFAULT and BROWSABLE to work properly.Step 2: Verify data attributes match the URL pattern
The URL myapp://user/123 has scheme="myapp", host="user", path="/123". Needs matching scheme, host, and pathPattern="/.*" for variable IDs.Step 3: Compare options
The filter with scheme="myapp", host="user", pathPattern="/.*", VIEW action, DEFAULT and BROWSABLE matches perfectly. pathPrefix="/user" without host mismatches path="/123". Missing BROWSABLE limits external opening. MAIN/LAUNCHER is incorrect for deep links.Final Answer:
Intent filter with VIEW action, DEFAULT/BROWSABLE categories, scheme myapp, host user, pathPattern /.* -> Option DQuick Check:
scheme=myapp host=user pathPattern=/.* VIEW BROWSABLE [OK]
- Missing BROWSABLE category
- Using MAIN action instead of VIEW
- Confusing pathPrefix with host+pathPattern
- Wrong categories for deep links
Ready to prove it?
Pass the test and this pattern moves unknown
