android-components / mozilla.components.feature.app.links / AppLinksUseCases

AppLinksUseCases

class AppLinksUseCases (source)

These use cases allow for the detection of, and opening of links that other apps have registered an IntentFilters to open.

Care is taken to:

  • resolve intent// links, including S.browser_fallback_url
  • provide a fallback to the installed marketplace app (e.g. on Google Android, the Play Store).
  • open HTTP(S) links with an external app.

Since browsers are able to open HTTPS pages, existing browser apps are excluded from the list of apps that trigger a redirect to an external app.

Types

Name Summary
GetAppLinkRedirect inner class GetAppLinkRedirect
Parse a URL and check if it can be handled by an app elsewhere on the Android device. If that app is not available, then a market place intent is also provided.
OpenAppLinkRedirect class OpenAppLinkRedirect
Open an external app with the redirect created by the GetAppLinkRedirect.

Constructors

Name Summary
<init> AppLinksUseCases(context: <ERROR CLASS>, browserPackageNames: Set<String>? = null, unguessableWebUrl: String = "https://${UUID.randomUUID()}.net")
These use cases allow for the detection of, and opening of links that other apps have registered an IntentFilters to open.

Properties

Name Summary
appLinkRedirect val appLinkRedirect: GetAppLinkRedirect
browserPackageNames val browserPackageNames: Set<String>
interceptedAppLinkRedirect val interceptedAppLinkRedirect: GetAppLinkRedirect
openAppLink val openAppLink: OpenAppLinkRedirect

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.