Page 1 of 1

Challenges with automating deep linking

Posted: Sat Jan 18, 2025 6:28 am
by ishanijerin1
In the Navigation component, when using explicit and implicit deep links, transitions are automatically performed, so it is not possible to insert processing before the transition. This behavior was the main reason why the requirement "Perform biometric authentication when the app is launched and when it returns to the background" could not be met.

Differences in behavior when the app is launched and when it returns to the background
When the app starts
Although deep linking is handled automatically in all launchModecases, the transition occurs before biometric authentication is performed, which does not meet the requirements.
When returning to the background
standardwould spawn a new activity, which would cause scotland email address the transition to be performed before the biometric authentication, and would therefore not meet the requirements.
singleTopsingleTaskActivities are reused in and onNewIntent()and deep links can be handled manually in , making it possible to insert biometric authentication.
Manual Processing
Instead of using the deep link described in the official documentation, we designed the transition to be controlled after biometric authentication is performed by manually implementing the transition.

Sample Code
override fun onResume() {
super .onResume()

// Get URI data from intent.
val data = intent?.data
if (data != null ) {
// Get destination and required data.
val destinationId = getDestinationId(data)
val bundle = getNavigationData(data)

if (destinationId != null && bundle != null ) {
// Execute the transition only if biometric authentication is successful
if (performBiometricAuthentication()) {
navController.navigate(destinationId, bundle)