How to open an android app as default using deeplink in Detox testing

Viewed 555

I am trying to open a particular page for my react native app using Detox. While passing the deeplink in the below methods, in Android it prompts to select either my app or Chrome. Is there a way to make my app as default for these links in Detox? I have tried both of these

await device.openURL({url: '{{URL}}'

and also

await device.launchApp({
  url: '{{URL}}',
  newInstance: false
})
2 Answers

use Firebase Dynamic Link

Receive Firebase Dynamic Links on Android

Create dynamic link with deep link from Firebase and just call the url of dynamic link.

You can adjust the behavior of the dynamic link from firebase console (for example: if the app is installed run this url using the app, if it is not installed use the browser)

place your package in sourceApp parameter

 await device.launchApp({
    newInstance: true,
    url: 'scheme://some.url',
    sourceApp: 'com.example.yourpackage'
  });
Related