BrowserActionsIntent
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 |
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 |
ITEM_COPY = 3 |
const Int |
ITEM_DOWNLOAD = 2 |
const Int |
ITEM_INVALID_ITEM = -1 |
const Int |
|
const Int |
|
const Int |
ITEM_SHARE = 4 |
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 |
MAX_CUSTOM_ITEMS = 5 The maximum allowed number of custom items. |
const Int |
URL_TYPE_AUDIO = 3 |
const Int |
URL_TYPE_FILE = 4 |
const Int |
URL_TYPE_IMAGE = 1 |
const Int |
URL_TYPE_NONE = 0 |
const Int |
URL_TYPE_PLUGIN = 5 |
const Int |
URL_TYPE_VIDEO = 2 |
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 |
java-static String? |
Get the package name of the creator application. |
java-static Unit |
Launch an Intent to open a Browser Actions menu. |
java-static Unit |
Construct a BrowserActionsIntent with default settings and launch it to open a Browser Actions menu. |
java-static Unit |
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
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.
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.
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.
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.
const val EXTRA_TYPE = "androidx.browser.browseractions.extra.TYPE": String!
Extra that specifies the type of url for the Browser Actions menu.
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.
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.
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.
Public functions
fungetIntent(): Intent
Gets the Intent of BrowserActionsIntent
.
Returns | |
---|---|
Intent |
the Intent of |
java-static fungetUntrustedCreatorPackageName(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 |
Returns | |
---|---|
String? |
The creator package name. |
java-static funlaunchIntent(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.
java-static funopenBrowserAction(context: Context, uri: Uri): Unit
Construct a BrowserActionsIntent with default settings and launch it to open a Browser Actions menu.
java-static funopenBrowserAction(
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. |
java-static funparseBrowserActionItems(bundles: ArrayList<Bundle!>): (Mutable)List<BrowserActionItem!>
Gets custom item list for browser action menu.
Parameters | |
---|---|
bundles: ArrayList<Bundle!> |
Data for custom items from |
Returns | |
---|---|
(Mutable)List<BrowserActionItem!> |
List of |