BrowserActionsIntent

Added in 1.2.0
Deprecated in 1.2.0

class BrowserActionsIntent


Class holding the Intent and start bundle for a Browser Actions Activity.

Note: The constants below are public for the browser implementation's benefit. You are strongly encouraged to use BrowserActionsIntent.Builder.

Summary

Nested types

Builder class for opening a Browser Actions context menu.

Constants

const String!
ACTION_BROWSER_ACTIONS_OPEN = "androidx.browser.browseractions.browser_action_open"

Indicates that the user explicitly opted out of Browser Actions in the calling application.

const String!
EXTRA_APP_ID = "androidx.browser.browseractions.APP_ID"

Extra that specifies PendingIntent indicating which Application sends the .

const String!
EXTRA_MENU_ITEMS = "androidx.browser.browseractions.extra.MENU_ITEMS"

Extra that specifies Listused for adding custom items to the Browser Actions menu.

const String!
EXTRA_SELECTED_ACTION_PENDING_INTENT = "androidx.browser.browseractions.extra.SELECTED_ACTION_PENDING_INTENT"

Extra that specifies the PendingIntent to be launched when a browser specified menu item is selected.

const String!
EXTRA_TYPE = "androidx.browser.browseractions.extra.TYPE"

Extra that specifies the type of url for the Browser Actions menu.

const Int
const Int
const Int
const Int
const Int
const Int
const String!
KEY_ACTION = "androidx.browser.browseractions.ACTION"

Extra PendingIntent to be launched when a custom item is selected in the Browser Actions menu.

const String!
KEY_ICON_ID = "androidx.browser.browseractions.ICON_ID"

Extra resource id that specifies the icon of a custom item shown in the Browser Actions menu.

const String!
KEY_TITLE = "androidx.browser.browseractions.TITLE"

Extra string that specifies the title of a custom item shown in the Browser Actions menu.

const Int

The maximum allowed number of custom items.

const Int
const Int
const Int
const Int
const Int
const Int

Public functions

java-static String?

This function is deprecated.

This return value of this method cannot be trusted, it is kept around for compatibility.

Intent

Gets the Intent of BrowserActionsIntent.

java-static String?

Get the package name of the creator application.

java-static Unit
launchIntent(context: Context, intent: Intent)

Launch an Intent to open a Browser Actions menu.

java-static Unit
openBrowserAction(context: Context, uri: Uri)

Construct a BrowserActionsIntent with default settings and launch it to open a Browser Actions menu.

java-static Unit
openBrowserAction(
    context: Context,
    uri: Uri,
    type: Int,
    items: ArrayList<BrowserActionItem!>,
    pendingIntent: PendingIntent
)

Construct a BrowserActionsIntent with custom settings and launch it to open a Browser Actions menu.

java-static (Mutable)List<BrowserActionItem!>

Gets custom item list for browser action menu.

Constants

ACTION_BROWSER_ACTIONS_OPEN

Added in 1.2.0
Deprecated in 1.2.0
const val ACTION_BROWSER_ACTIONS_OPEN = "androidx.browser.browseractions.browser_action_open": String!

Indicates that the user explicitly opted out of Browser Actions in the calling application.

EXTRA_APP_ID

Added in 1.2.0
Deprecated in 1.2.0
const val EXTRA_APP_ID = "androidx.browser.browseractions.APP_ID": String!

Extra that specifies PendingIntent indicating which Application sends the .

Note: The PendingIntent is self-reported and untrusted, sending application can modify it to use PendingIntent from other apps. This would return the package name from the app who creates the PendintIntent.

EXTRA_MENU_ITEMS

Added in 1.2.0
Deprecated in 1.2.0
const val EXTRA_MENU_ITEMS = "androidx.browser.browseractions.extra.MENU_ITEMS": String!

Extra that specifies Listused for adding custom items to the Browser Actions menu.

EXTRA_SELECTED_ACTION_PENDING_INTENT

Added in 1.2.0
Deprecated in 1.2.0
const val EXTRA_SELECTED_ACTION_PENDING_INTENT = "androidx.browser.browseractions.extra.SELECTED_ACTION_PENDING_INTENT": String!

Extra that specifies the PendingIntent to be launched when a browser specified menu item is selected. The id of the chosen item will be notified through the data of its Intent.

EXTRA_TYPE

Added in 1.2.0
Deprecated in 1.2.0
const val EXTRA_TYPE = "androidx.browser.browseractions.extra.TYPE": String!

Extra that specifies the type of url for the Browser Actions menu.

ITEM_COPY

Added in 1.2.0
Deprecated in 1.2.0
const val ITEM_COPY = 3: Int

ITEM_DOWNLOAD

Added in 1.2.0
Deprecated in 1.2.0
const val ITEM_DOWNLOAD = 2: Int

ITEM_INVALID_ITEM

Added in 1.2.0
Deprecated in 1.2.0
const val ITEM_INVALID_ITEM = -1: Int

ITEM_OPEN_IN_INCOGNITO

Added in 1.2.0
Deprecated in 1.2.0
const val ITEM_OPEN_IN_INCOGNITO = 1: Int

ITEM_OPEN_IN_NEW_TAB

Added in 1.2.0
Deprecated in 1.2.0
const val ITEM_OPEN_IN_NEW_TAB = 0: Int

ITEM_SHARE

Added in 1.2.0
Deprecated in 1.2.0
const val ITEM_SHARE = 4: Int

KEY_ACTION

Added in 1.2.0
Deprecated in 1.2.0
const val KEY_ACTION = "androidx.browser.browseractions.ACTION": String!

Extra PendingIntent to be launched when a custom item is selected in the Browser Actions menu.

KEY_ICON_ID

Added in 1.2.0
Deprecated in 1.2.0
const val KEY_ICON_ID = "androidx.browser.browseractions.ICON_ID": String!

Extra resource id that specifies the icon of a custom item shown in the Browser Actions menu.

KEY_TITLE

Added in 1.2.0
Deprecated in 1.2.0
const val KEY_TITLE = "androidx.browser.browseractions.TITLE": String!

Extra string that specifies the title of a custom item shown in the Browser Actions menu.

MAX_CUSTOM_ITEMS

Added in 1.2.0
Deprecated in 1.2.0
const val MAX_CUSTOM_ITEMS = 5: Int

The maximum allowed number of custom items.

URL_TYPE_AUDIO

Added in 1.2.0
Deprecated in 1.2.0
const val URL_TYPE_AUDIO = 3: Int

URL_TYPE_FILE

Added in 1.2.0
Deprecated in 1.2.0
const val URL_TYPE_FILE = 4: Int

URL_TYPE_IMAGE

Added in 1.2.0
Deprecated in 1.2.0
const val URL_TYPE_IMAGE = 1: Int

URL_TYPE_NONE

Added in 1.2.0
Deprecated in 1.2.0
const val URL_TYPE_NONE = 0: Int

URL_TYPE_PLUGIN

Added in 1.2.0
Deprecated in 1.2.0
const val URL_TYPE_PLUGIN = 5: Int

URL_TYPE_VIDEO

Added in 1.2.0
Deprecated in 1.2.0
const val URL_TYPE_VIDEO = 2: Int

Public functions

getCreatorPackageName

Added in 1.2.0
Deprecated in 1.2.0
java-static fun getCreatorPackageName(intent: Intent): String?

getIntent

Added in 1.2.0
Deprecated in 1.2.0
fun getIntent(): Intent

Gets the Intent of BrowserActionsIntent.

Returns
Intent

the Intent of BrowserActionsIntent.

getUntrustedCreatorPackageName

Added in 1.2.0
Deprecated in 1.2.0
java-static fun getUntrustedCreatorPackageName(intent: Intent): String?

Get the package name of the creator application.

Note: This is self-reported and could be untrusted. Intent sender can modify it to return the package name from a different application.

Parameters
intent: Intent

The BrowserActionsIntent.

Returns
String?

The creator package name.

launchIntent

Added in 1.2.0
Deprecated in 1.2.0
java-static fun launchIntent(context: Context, intent: Intent): Unit

Launch an Intent to open a Browser Actions menu. It first checks if any Browser Actions provider is available to create the menu. If the default Browser supports Browser Actions, menu will be opened by the default Browser, otherwise show a intent picker. If not provider, a Browser Actions menu is opened locally from support library.

Parameters
context: Context

The context requesting for a Browser Actions menu.

intent: Intent

The Intent holds the setting for Browser Actions menu.

openBrowserAction

Added in 1.2.0
Deprecated in 1.2.0
java-static fun openBrowserAction(context: Context, uri: Uri): Unit

Construct a BrowserActionsIntent with default settings and launch it to open a Browser Actions menu.

Parameters
context: Context

The context requesting for a Browser Actions menu.

uri: Uri

The url for Browser Actions menu.

openBrowserAction

Added in 1.2.0
Deprecated in 1.2.0
java-static fun openBrowserAction(
    context: Context,
    uri: Uri,
    type: Int,
    items: ArrayList<BrowserActionItem!>,
    pendingIntent: PendingIntent
): Unit

Construct a BrowserActionsIntent with custom settings and launch it to open a Browser Actions menu.

Parameters
context: Context

The context requesting for a Browser Actions menu.

uri: Uri

The url for Browser Actions menu.

type: Int

The type of the url for context menu to be opened.

items: ArrayList<BrowserActionItem!>

List of custom items to be added to Browser Actions menu.

pendingIntent: PendingIntent

The PendingIntent to be launched when a browser specified menu item is selected.

parseBrowserActionItems

Added in 1.2.0
Deprecated in 1.2.0
java-static fun parseBrowserActionItems(bundles: ArrayList<Bundle!>): (Mutable)List<BrowserActionItem!>

Gets custom item list for browser action menu.

Parameters
bundles: ArrayList<Bundle!>

Data for custom items from BrowserActionsIntent.