CustomTabsService
abstract class CustomTabsService : Service
kotlin.Any | ||||
↳ | android.content.Context | |||
↳ | android.content.ContextWrapper | |||
↳ | android.app.Service | |||
↳ | androidx.browser.customtabs.CustomTabsService |
Abstract service class for implementing Custom Tabs related functionality. The service should be responding to the action ACTION_CUSTOM_TABS_CONNECTION. This class should be used by implementers that want to provide Custom Tabs functionality, not by clients that want to launch Custom Tabs.
Summary
Nested classes | |
---|---|
Constants | |
---|---|
static String |
The Intent action that a CustomTabsService must respond to. |
static String |
An Intent filter category to signify that the Custom Tabs provider supports selecting and customizing color schemes via |
static String |
An Intent filter category to signify that the Custom Tabs provider supports customizing the color of the navigation bar ( |
static String |
An Intent filter category to signify that the Trusted Web Activity provider supports immersive mode. |
static String |
An Intent filter category to signify that the Trusted Web Activity provider supports sending shared data according to the Web Share Target v2 protocol defined in https://wicg. |
static Int |
A constant to be used with |
static String |
The key to use to store a boolean in the returns bundle of |
static String |
For |
static Int |
Used for |
static Int |
Used for |
static Int |
Indicates that the postMessage request was not allowed due to a bad argument or requesting at a disallowed time like when in background. |
static Int |
Indicates that the postMessage request has failed due to an internal error on the browser message channel. |
static Int |
Indicates that the postMessage request has failed due to a |
static Int |
Indicates that the postMessage request was accepted. |
static String |
An Intent filter category to signify that the Custom Tabs provider supports Trusted Web Activities (see |
Public constructors | |
---|---|
<init>() Abstract service class for implementing Custom Tabs related functionality. |
Public methods | |
---|---|
open IBinder |
Protected methods | |
---|---|
open Boolean |
cleanUpSession(@NonNull sessionToken: CustomTabsSessionToken) Called when the client side |
abstract Bundle? |
extraCommand(@NonNull commandName: String, @Nullable args: Bundle?) Unsupported commands that may be provided by the implementation. |
abstract Boolean |
mayLaunchUrl(@NonNull sessionToken: CustomTabsSessionToken, @Nullable url: Uri?, @Nullable extras: Bundle?, @Nullable otherLikelyBundles: MutableList<Bundle!>?) Tells the browser of a likely future navigation to a URL. |
abstract Boolean |
newSession(@NonNull sessionToken: CustomTabsSessionToken) Creates a new session through an ICustomTabsService with the optional callback. |
abstract Int |
postMessage(@NonNull sessionToken: CustomTabsSessionToken, @NonNull message: String, @Nullable extras: Bundle?) Sends a postMessage request using the origin communicated via |
abstract Boolean |
receiveFile(@NonNull sessionToken: CustomTabsSessionToken, @NonNull uri: Uri, purpose: Int, @Nullable extras: Bundle?) Receive a file from client by given Uri, e. |
abstract Boolean |
requestPostMessageChannel(@NonNull sessionToken: CustomTabsSessionToken, @NonNull postMessageOrigin: Uri) Sends a request to create a two way postMessage channel between the client and the browser linked with the given |
abstract Boolean |
updateVisuals(@NonNull sessionToken: CustomTabsSessionToken, @Nullable bundle: Bundle?) Updates the visuals of custom tabs for the given session. |
abstract Boolean |
validateRelationship(@NonNull sessionToken: CustomTabsSessionToken, relation: Int, @NonNull origin: Uri, @Nullable extras: Bundle?) Request to validate a relationship between the application and an origin. |
abstract Boolean |
Warms up the browser process asynchronously. |
Constants
ACTION_CUSTOM_TABS_CONNECTION
static val ACTION_CUSTOM_TABS_CONNECTION: String
The Intent action that a CustomTabsService must respond to.
Value: "android.support.customtabs.action.CustomTabsService"
CATEGORY_COLOR_SCHEME_CUSTOMIZATION
static val CATEGORY_COLOR_SCHEME_CUSTOMIZATION: String
An Intent filter category to signify that the Custom Tabs provider supports selecting and customizing color schemes via CustomTabsIntent.Builder#setColorScheme
and CustomTabsIntent.Builder#setColorSchemeParams
.
Value: "androidx.browser.customtabs.category.ColorSchemeCustomization"
CATEGORY_NAVBAR_COLOR_CUSTOMIZATION
static val CATEGORY_NAVBAR_COLOR_CUSTOMIZATION: String
An Intent filter category to signify that the Custom Tabs provider supports customizing the color of the navigation bar (CustomTabsIntent.Builder#setNavigationBarColor
).
Value: "androidx.browser.customtabs.category.NavBarColorCustomization"
CATEGORY_TRUSTED_WEB_ACTIVITY_IMMERSIVE_MODE
static val CATEGORY_TRUSTED_WEB_ACTIVITY_IMMERSIVE_MODE: String
An Intent filter category to signify that the Trusted Web Activity provider supports immersive mode.
Value: "androidx.browser.trusted.category.ImmersiveMode"
CATEGORY_WEB_SHARE_TARGET_V2
static val CATEGORY_WEB_SHARE_TARGET_V2: String
An Intent filter category to signify that the Trusted Web Activity provider supports sending shared data according to the Web Share Target v2 protocol defined in https://wicg.github.io/web-share-target/level-2/.
Value: "androidx.browser.trusted.category.WebShareTargetV2"
FILE_PURPOSE_TRUSTED_WEB_ACTIVITY_SPLASH_IMAGE
static val FILE_PURPOSE_TRUSTED_WEB_ACTIVITY_SPLASH_IMAGE: Int
A constant to be used with CustomTabsSession#receiveFile
indicating that the file is a splash image to be shown on top of a Trusted Web Activity while the web contents are loading.
Value: 1
KEY_SUCCESS
static val KEY_SUCCESS: String
The key to use to store a boolean in the returns bundle of extraCommand
method, to indicate the command is executed successfully.
Value: "androidx.browser.customtabs.SUCCESS"
KEY_URL
static val KEY_URL: String
For CustomTabsService#mayLaunchUrl
calls that wants to specify more than one url, this key can be used with Bundle#putParcelable(String, android.os.Parcelable)
to insert a new url to each bundle inside list of bundles.
Value: "android.support.customtabs.otherurls.URL"
RELATION_HANDLE_ALL_URLS
static val RELATION_HANDLE_ALL_URLS: Int
Used for CustomTabsSession#validateRelationship(int, Uri, Bundle)
. Requests the ability to handle all URLs from a given origin.
Value: 2
RELATION_USE_AS_ORIGIN
static val RELATION_USE_AS_ORIGIN: Int
Used for CustomTabsSession#validateRelationship(int, Uri, Bundle)
. For App -> Web transitions, requests the app to use the declared origin to be used as origin for the client app in the web APIs context.
Value: 1
RESULT_FAILURE_DISALLOWED
static val RESULT_FAILURE_DISALLOWED: Int
Indicates that the postMessage request was not allowed due to a bad argument or requesting at a disallowed time like when in background.
Value: -1
RESULT_FAILURE_MESSAGING_ERROR
static val RESULT_FAILURE_MESSAGING_ERROR: Int
Indicates that the postMessage request has failed due to an internal error on the browser message channel.