Bird
Raised Fist0
Android Kotlinmobile~15 mins

Deep links in Android Kotlin - Deep Dive

Choose your learning style10 modes available
Overview - Deep links
What is it?
Deep links are special links that open a specific part of a mobile app directly, instead of just launching the app's home screen. They work like web URLs but take users straight to content inside the app. This helps users jump right to what they want without extra taps.
Why it matters
Without deep links, users would have to open the app and navigate manually to find content, which wastes time and causes frustration. Deep links make apps feel faster and smarter by connecting external sources like emails or websites directly to app pages. This improves user experience and engagement.
Where it fits
Before learning deep links, you should understand basic Android app structure and navigation. After mastering deep links, you can explore app linking with web URLs, app intents, and user experience optimization.
Mental Model
Core Idea
Deep links are like special addresses that take users directly to a specific room inside a big building (the app) instead of just the front door.
Think of it like...
Imagine a mall with many stores. Normally, you enter through the main entrance and walk to the store you want. Deep links are like having a private door that leads you straight into your favorite store without walking through the mall.
App Launch Flow with Deep Links

[External Link]
      ↓
[Android System]
      ↓
[App Intent Filter]
      ↓
[Specific Screen in App]

Without Deep Link:
[External Link]
      ↓
[Android System]
      ↓
[App Home Screen]
      ↓
[User Navigates Manually]
Build-Up - 6 Steps
1
FoundationWhat Are Deep Links
🤔
Concept: Introduce the basic idea of deep links as URLs that open specific app screens.
Deep links are URLs that point to a particular page or feature inside a mobile app. Instead of just opening the app's main screen, they take the user directly to the content they want. For example, a link might open a product page inside a shopping app.
Result
Users can open the app directly to the desired content from outside sources like emails or websites.
Understanding deep links helps you see how apps can connect smoothly with other apps and the web, improving user flow.
2
FoundationHow Android Handles Deep Links
🤔
Concept: Explain Android's intent filters and how they catch deep link URLs.
Android apps declare intent filters in their manifest file. These filters tell the system which URLs the app can open. When a user clicks a matching link, Android launches the app and sends the URL data to it. The app then reads this data to show the right screen.
Result
The app receives the deep link URL and can navigate to the correct screen automatically.
Knowing intent filters is key to making deep links work because they connect external links to app screens.
3
IntermediateCreating Deep Links in Kotlin
🤔Before reading on: Do you think deep links require special code inside the app, or only manifest changes? Commit to your answer.
Concept: Show how to declare deep links in the manifest and handle them in Kotlin code.
In AndroidManifest.xml, add an intent filter with , , and . Specify the scheme, host, and path for your deep link URL. In your Kotlin activity, get the intent's data with intent.data to read the URL and navigate accordingly.
Result
The app opens the correct screen based on the deep link URL parameters.
Combining manifest setup with Kotlin code lets your app respond dynamically to deep links.
4
IntermediateHandling Parameters in Deep Links
🤔Before reading on: Do you think deep links can carry extra data like product IDs, or only open fixed screens? Commit to your answer.
Concept: Explain how deep links can include parameters to show dynamic content.
Deep link URLs can have query parameters or path variables, like myapp://product/123 or myapp://search?q=shoes. Your app reads these parameters from the intent data and uses them to load specific content, such as a product page or search results.
Result
Users land on personalized content inside the app, improving relevance and experience.
Understanding parameters in deep links unlocks powerful ways to customize user journeys.
5
AdvancedApp Links and Verification
🤔Before reading on: Do you think Android treats all deep links equally, or are some more secure and trusted? Commit to your answer.
Concept: Introduce Android App Links, which verify ownership of web domains for secure deep linking.
Android App Links are verified deep links that only open your app if you own the linked website. You add a Digital Asset Links file to your website and configure intent filters with autoVerify=true. This prevents other apps from hijacking your links and improves user trust.
Result
Users get a seamless and secure experience when opening links from trusted sources.
Knowing about App Links helps you build secure, professional apps that protect users and brand reputation.
6
ExpertDeep Links in Complex Navigation Architectures
🤔Before reading on: Do you think deep links always open a single screen, or can they restore complex navigation states? Commit to your answer.
Concept: Explain how deep links integrate with navigation components and multi-screen flows.
In apps using Jetpack Navigation or similar, deep links can restore entire navigation stacks, not just one screen. You define deep links in navigation graphs and handle parameters to rebuild the user's path. This supports scenarios like opening a chat inside a group inside a tab, preserving back navigation.
Result
Users experience natural navigation flows even when entering the app deep inside complex screens.
Understanding deep links with navigation graphs is crucial for building scalable, user-friendly apps.
Under the Hood
When a user clicks a deep link, the Android system checks all installed apps for intent filters matching the link's scheme, host, and path. If a match is found, Android launches the app with an intent containing the link data. The app reads this intent data to decide which screen to show. For App Links, Android verifies the website's ownership via a Digital Asset Links file before opening the app automatically.
Why designed this way?
This design lets apps integrate smoothly with the web and other apps using a standard URL format. Intent filters provide a flexible way to declare which links an app can handle. Verification with App Links prevents malicious apps from intercepting links, protecting users and brands. The system balances openness with security and user choice.
┌───────────────┐
│ User Clicks   │
│ Deep Link URL │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Android System│
│ Matches Intent│
│ Filter in App │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Launch App    │
│ with Intent   │
│ (URL Data)    │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ App Reads URL │
│ and Navigates │
│ to Screen     │
└───────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Do you think deep links always open the app's home screen? Commit yes or no.
Common Belief:Deep links just open the app's main screen like normal app launches.
Tap to reveal reality
Reality:Deep links open specific screens or content inside the app, not just the home screen.
Why it matters:Believing this causes missed opportunities to improve user experience by directing users exactly where they want to go.
Quick: Do you think any URL can automatically open your app without setup? Commit yes or no.
Common Belief:Any link to my app's website will open the app automatically without extra configuration.
Tap to reveal reality
Reality:You must declare intent filters and verify domains for Android to open your app from URLs.
Why it matters:Assuming automatic linking leads to broken links and frustrated users when the app doesn't open as expected.
Quick: Do you think deep links can only open one screen, or can they restore complex navigation? Commit your answer.
Common Belief:Deep links only open a single screen and cannot restore navigation history.
Tap to reveal reality
Reality:Deep links can restore entire navigation stacks using navigation components, preserving user flow.
Why it matters:Ignoring this limits app design and leads to poor back navigation and user confusion.
Quick: Do you think App Links are just a naming convention or do they add security? Commit yes or no.
Common Belief:App Links are just special URLs with no extra security benefits.
Tap to reveal reality
Reality:App Links verify website ownership to prevent link hijacking and improve user trust.
Why it matters:Not using App Links risks malicious apps intercepting your links, harming users and your brand.
Expert Zone
1
Deep links can trigger different app behaviors depending on app state, such as cold start versus background resume, requiring careful intent handling.
2
Handling multiple deep link formats and fallback URLs improves robustness across different sources and platforms.
3
Combining deep links with push notifications and analytics enables personalized user journeys and tracking.
When NOT to use
Avoid deep links for very simple apps with only one screen or no meaningful internal navigation. Instead, use standard app launches. Also, if your app does not own a web domain, App Links verification is not possible, so rely on custom schemes carefully.
Production Patterns
In production, apps use deep links to enable marketing campaigns, social sharing, and onboarding flows. They combine deep links with navigation components and ViewModels to restore state. Apps also implement fallback logic to open web pages if the app is not installed.
Connections
Web URLs and HTTP Protocol
Deep links use URL patterns similar to web URLs to identify content.
Understanding web URLs helps grasp how deep links encode app navigation paths and parameters.
Intent System in Android
Deep links rely on Android's intent system to route external requests to app components.
Knowing intents clarifies how Android matches links to apps and passes data for navigation.
User Experience Design
Deep links improve user experience by reducing navigation friction and time to content.
Recognizing deep links as a UX tool helps design smoother app flows and higher engagement.
Common Pitfalls
#1Deep link opens app but shows wrong screen or crashes.
Wrong approach:In onCreate(): val data = intent.data if (data != null) { // no validation or parsing navigateToScreen(data.toString()) }
Correct approach:val data = intent.data if (data != null && isValidDeepLink(data)) { val id = data.getQueryParameter("id") if (id != null) { navigateToProductScreen(id) } }
Root cause:Not validating or parsing deep link data properly leads to errors or wrong navigation.
#2Declaring intent filters without BROWSABLE category causes links not to open app from browsers.
Wrong approach:
Correct approach:
Root cause:Missing BROWSABLE category means the system won't allow links from browsers to open the app.
#3Assuming deep links work without testing on real devices or different Android versions.
Wrong approach:Only testing deep links on emulator or ignoring edge cases like app not installed.
Correct approach:Test deep links on multiple devices and Android versions; implement fallback URLs for missing app.
Root cause:Deep linking behavior varies by device and Android version; lack of testing causes broken user experience.
Key Takeaways
Deep links let users open specific app screens directly from external links, improving speed and experience.
Android uses intent filters to match deep link URLs and launch the app with data for navigation.
Deep links can carry parameters to show dynamic content, not just fixed screens.
App Links add security by verifying website ownership, preventing malicious link hijacking.
Integrating deep links with navigation components enables restoring complex app states and smooth user flows.

Practice

(1/5)
1. What is the main purpose of a deep link in an Android app?
easy
A. To open a specific screen inside the app from an external URL
B. To update the app's user interface colors
C. To increase the app's memory usage
D. To change the app's icon on the home screen

Solution

  1. 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.
  2. 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.
  3. Final Answer:

    To open a specific screen inside the app from an external URL -> Option A
  4. Quick Check:

    Deep link purpose = open specific screen [OK]
Hint: Deep links open app screens from outside links [OK]
Common Mistakes:
  • Confusing deep links with UI styling
  • Thinking deep links change app icons
  • Assuming deep links increase memory
2. Which XML element is used to declare a deep link in AndroidManifest.xml?
easy
A. <provider>
B.
C. <service>
D. <activity>

Solution

  1. Step 1: Identify where deep links are declared

    Deep links are declared inside an element within an activity in AndroidManifest.xml.
  2. Step 2: Match options to this element

    Only is used to specify deep link URL patterns and actions.
  3. Final Answer:

    <intent-filter> -> Option B
  4. Quick Check:

    Deep links declared in intent-filter [OK]
Hint: Deep links go inside intent-filter tags [OK]
Common Mistakes:
  • Confusing activity tag with deep link declaration
  • Using service or provider tags incorrectly
  • Not nesting intent-filter inside activity
3. Given this intent filter snippet in AndroidManifest.xml, what URL will open the app's 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>
medium
A. https://example.com/about
B. http://example.com/profile
C. https://example.com/profile/settings
D. https://example.org/profile

Solution

  1. 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.
  2. 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.
  3. Final Answer:

    https://example.com/profile/settings -> Option C
  4. Quick Check:

    Match scheme, host, pathPrefix = https://example.com/profile/settings [OK]
Hint: Match scheme, host, and pathPrefix exactly [OK]
Common Mistakes:
  • Ignoring scheme (http vs https)
  • Confusing host names
  • Not checking pathPrefix carefully
4. What is wrong with this intent filter for a deep link?
<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.LAUNCHER" />
  <data android:scheme="myapp" />
</intent-filter>
medium
A. It uses LAUNCHER category instead of BROWSABLE
B. It is missing the action VIEW
C. The scheme attribute is invalid
D. It should be inside a service tag

Solution

  1. Step 1: Check required categories for deep links

    Deep links require the BROWSABLE category to allow opening from browsers or external apps.
  2. Step 2: Identify incorrect category usage

    This intent filter uses LAUNCHER category, which is for app launchers, not deep links.
  3. Final Answer:

    It uses LAUNCHER category instead of BROWSABLE -> Option A
  4. Quick Check:

    Deep links need BROWSABLE category [OK]
Hint: Deep links need BROWSABLE, not LAUNCHER category [OK]
Common Mistakes:
  • Using LAUNCHER category for deep links
  • Forgetting to add BROWSABLE category
  • Placing intent-filter inside wrong tag
5. You want your app to open a user profile screen when a link like myapp://user/123 is clicked. Which intent filter correctly handles this deep link?
hard
A. \n \n \n \n
B. \n \n \n \n \n
C. \n \n \n \n
D. \n \n \n \n \n

Solution

  1. Step 1: Check required action and categories for deep links

    Deep links need action VIEW and categories DEFAULT and BROWSABLE to work properly.
  2. 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.
  3. 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.
  4. Final Answer:

    Intent filter with VIEW action, DEFAULT/BROWSABLE categories, scheme myapp, host user, pathPattern /.* -> Option D
  5. Quick Check:

    scheme=myapp host=user pathPattern=/.* VIEW BROWSABLE [OK]
Hint: VIEW action, DEFAULT/BROWSABLE categories, scheme+host+pathPattern [OK]
Common Mistakes:
  • Missing BROWSABLE category
  • Using MAIN action instead of VIEW
  • Confusing pathPrefix with host+pathPattern
  • Wrong categories for deep links
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard