I have to run some tests in an alpha version of an application. In these, I need to get a fresh install, navigate to some link and there, tap the 'Open in app button'.
For that to work, I previously need to set the app as default to open links from that site?
Since I need this to run in many different devices, executing the steps via UI interaction is not a good approach...
Is there any way that this can be done via adb commands?
What I am trying to do via adb commands is what manually you would do: Settings > Apps > AlphaVersion app > Set as default > Open supported links (enabled)
CodePudding user response:
Use
adb shell pm get-app-link-owners [--user <USER_ID>] [--package <PACKAGE>] [<DOMAINS>]
To get which packages are responsible for opening the desired domain link along with their priority order. You can disable applications responsible for opening the link which are higher in the priority order, so that the desired domain is accessed only through the application, using :
adb shell pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT
Further, use :
adb shell pm set-app-links-allowed --user <USER_ID> [--package <PACKAGE>] <ALLOWED>
To turn the auto verified link handling of the desired domain and package to be true.
This however, doesn't automatically set your application as the default handler for the domain links, but one of the applications that handles the link on some of the ROMs.
For a permanent solution :
- You can use Deep links with intents in Android OR use Android App Links, available on API level 23 and higher which contain the verify attribute.
- Deep Links allow the user to go to any specific part of the application , using intent filters. As a workaround, disable all the other applications that come in disambiguation dialog.
- Android App Links will require you to declare website associations using a JSON file hosted on the website, which can be tricky if you don't have access to the domain.