Bird
Raised Fist0
Android Kotlinmobile~20 mins

Deep links in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Deep Link Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate
2:00remaining
What happens when a deep link is triggered?
Consider an Android app with a deep link configured to open a specific screen. What is the expected behavior when the deep link URL is clicked?
AThe app opens the home screen of the device instead of the app.
BThe app opens the launcher screen first, then navigates to the specified screen after a delay.
CThe app opens directly to the specified screen without showing the launcher or home screen.
DThe app crashes because deep links are not supported by default.
Attempts:
2 left
💡 Hint
Think about what deep links are designed to do: take users straight to content.
🧠 Conceptual
intermediate
2:00remaining
Which AndroidManifest.xml element defines a deep link?
In Android development, which element inside the AndroidManifest.xml file is used to declare a deep link for an activity?
A<meta-data> with the deep link URI inside
B<service> with <intent-filter> specifying the deep link URI
C<provider> with <data> specifying the deep link URI
D<intent-filter> with <action android:name="android.intent.action.VIEW"/> and <data> specifying the URI
Attempts:
2 left
💡 Hint
Deep links are triggered by intents targeting activities.
❓ lifecycle
advanced
2:00remaining
What lifecycle method is called when an activity is opened via a deep link?
When an Android activity is opened through a deep link while the app is already running, which lifecycle method is called to handle the new intent?
AonNewIntent(Intent intent)
BonCreate(Bundle savedInstanceState)
ConStart()
DonResume()
Attempts:
2 left
💡 Hint
Think about how Android delivers new intents to existing activities.
🔧 Debug
advanced
2:00remaining
Why does this deep link not open the app?
An app has this intent filter in AndroidManifest.xml: Clicking the URL http://example.com/open/page does not open the app. Why?
AThe pathPrefix matches "/open" and all subpaths, so the problem is elsewhere.
BThe intent filter is missing the android:port attribute, so it won't match URLs with ports.
CThe app is not installed, so the deep link cannot open it.
DThe pathPrefix "/open" does not match "/open/page" because pathPrefix matches only the exact path.
Attempts:
2 left
💡 Hint
Check how pathPrefix matching works in Android deep links.
❓ navigation
expert
3:00remaining
How to handle multiple deep links with different parameters in one activity?
You want one activity to handle deep links like myapp://product/123 and myapp://category/456. How should you configure the intent filter and handle navigation in Kotlin?
Android Kotlin
override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  val data = intent?.data
  when {
    data?.pathSegments?.getOrNull(0) == "product" -> {
      val productId = data.pathSegments[1]
      // Navigate to product screen with productId
    }
    data?.pathSegments?.getOrNull(0) == "category" -> {
      val categoryId = data.pathSegments[1]
      // Navigate to category screen with categoryId
    }
  }
}
ACreate separate activities for product and category and separate intent filters for each URI pattern.
BUse one intent filter with <data android:scheme="myapp" /> and parse pathSegments in onCreate to route accordingly.
CUse multiple intent filters with different schemes for product and category URIs.
DHandle deep links only in the launcher activity and ignore intent filters.
Attempts:
2 left
💡 Hint
One activity can handle multiple deep link paths by parsing the URI.

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