BrowserActionsIntent
public
class
BrowserActionsIntent
extends Object
java.lang.Object | |
↳ | androidx.browser.browseractions.BrowserActionsIntent |
This class is deprecated.
Browser Actions are deprecated as of release 1.2.0.
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 classes | |
---|---|
class |
BrowserActionsIntent.Builder
Builder class for opening a Browser Actions context menu. |
Constants | |
---|---|
String |
ACTION_BROWSER_ACTIONS_OPEN
Indicates that the user explicitly opted out of Browser Actions in the calling application. |
String |
EXTRA_APP_ID
Extra that specifies |
String |
EXTRA_MENU_ITEMS
Extra that specifies List |
String |
EXTRA_SELECTED_ACTION_PENDING_INTENT
Extra that specifies the PendingIntent to be launched when a browser specified menu item is selected. |
String |
EXTRA_TYPE
Extra that specifies the type of url for the Browser Actions menu. |
int |
ITEM_COPY
|
int |
ITEM_DOWNLOAD
|
int |
ITEM_INVALID_ITEM
|
int |
ITEM_OPEN_IN_INCOGNITO
|
int |
ITEM_OPEN_IN_NEW_TAB
|
int |
ITEM_SHARE
|
String |
KEY_ACTION
Extra PendingIntent to be launched when a custom item is selected in the Browser Actions menu. |
String |
KEY_ICON_ID
Extra resource id that specifies the icon of a custom item shown in the Browser Actions menu. |
String |
KEY_TITLE
Extra string that specifies the title of a custom item shown in the Browser Actions menu. |
int |
MAX_CUSTOM_ITEMS
The maximum allowed number of custom items. |
int |
URL_TYPE_AUDIO
|
int |
URL_TYPE_FILE
|
int |
URL_TYPE_IMAGE
|
int |
URL_TYPE_NONE
|
int |
URL_TYPE_PLUGIN
|
int |
URL_TYPE_VIDEO
|
Public methods | |
---|---|
static
String
|
getCreatorPackageName(Intent intent)
This method is deprecated.
This return value of this method cannot be trusted, it is kept around for
compatibility. Use |
Intent
|
getIntent()
Gets the Intent of |
static
String
|
getUntrustedCreatorPackageName(Intent intent)
Get the package name of the creator application. |
static
void
|
launchIntent(Context context, Intent intent)
Launch an Intent to open a Browser Actions menu. |
static
void
|
openBrowserAction(Context context, Uri uri, int type, ArrayList<BrowserActionItem> items, PendingIntent pendingIntent)
Construct a BrowserActionsIntent with custom settings and launch it to open a Browser Actions menu. |
static
void
|
openBrowserAction(Context context, Uri uri)
Construct a BrowserActionsIntent with default settings and launch it to open a Browser Actions menu. |
static
List<BrowserActionItem>
|
parseBrowserActionItems(ArrayList<Bundle> bundles)
Gets custom item list for browser action menu. |
Inherited methods | |
---|---|
Constants
ACTION_BROWSER_ACTIONS_OPEN
public static final String ACTION_BROWSER_ACTIONS_OPEN
Indicates that the user explicitly opted out of Browser Actions in the calling application.
Constant Value: "androidx.browser.browseractions.browser_action_open"
EXTRA_APP_ID
public static final String EXTRA_APP_ID
Extra that specifies PendingIntent
indicating which Application sends the BrowserActionsIntent
.
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.
Constant Value: "androidx.browser.browseractions.APP_ID"
EXTRA_MENU_ITEMS
public static final String EXTRA_MENU_ITEMS
Extra that specifies List
Constant Value: "androidx.browser.browseractions.extra.MENU_ITEMS"
EXTRA_SELECTED_ACTION_PENDING_INTENT
public static final String EXTRA_SELECTED_ACTION_PENDING_INTENT
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.
Constant Value: "androidx.browser.browseractions.extra.SELECTED_ACTION_PENDING_INTENT"
EXTRA_TYPE
public static final String EXTRA_TYPE
Extra that specifies the type of url for the Browser Actions menu.
Constant Value: "androidx.browser.browseractions.extra.TYPE"
ITEM_COPY
public static final int ITEM_COPY
Constant Value: 3 (0x00000003)
ITEM_DOWNLOAD
public static final int ITEM_DOWNLOAD
Constant Value: 2 (0x00000002)
ITEM_INVALID_ITEM
public static final int ITEM_INVALID_ITEM
Constant Value: -1 (0xffffffff)
ITEM_OPEN_IN_INCOGNITO
public static final int ITEM_OPEN_IN_INCOGNITO
Constant Value: 1 (0x00000001)
ITEM_OPEN_IN_NEW_TAB
public static final int ITEM_OPEN_IN_NEW_TAB
Constant Value: 0 (0x00000000)
ITEM_SHARE
public static final int ITEM_SHARE
Constant Value: 4 (0x00000004)
KEY_ACTION
public static final String KEY_ACTION
Extra PendingIntent to be launched when a custom item is selected in the Browser Actions menu.
Constant Value: "androidx.browser.browseractions.ACTION"
KEY_ICON_ID
public static final String KEY_ICON_ID
Extra resource id that specifies the icon of a custom item shown in the Browser Actions menu.
Constant Value: "androidx.browser.browseractions.ICON_ID"
KEY_TITLE
public static final String KEY_TITLE
Extra string that specifies the title of a custom item shown in the Browser Actions menu.
Constant Value: "androidx.browser.browseractions.TITLE"
MAX_CUSTOM_ITEMS
public static final int MAX_CUSTOM_ITEMS
The maximum allowed number of custom items.
Constant Value: 5 (0x00000005)
URL_TYPE_AUDIO
public static final int URL_TYPE_AUDIO
Constant Value: 3 (0x00000003)
URL_TYPE_FILE
public static final int URL_TYPE_FILE
Constant Value: 4 (0x00000004)
URL_TYPE_IMAGE
public static final int URL_TYPE_IMAGE
Constant Value: 1 (0x00000001)
URL_TYPE_NONE
public static final int URL_TYPE_NONE
Constant Value: 0 (0x00000000)
URL_TYPE_PLUGIN
public static final int URL_TYPE_PLUGIN
Constant Value: 5 (0x00000005)
URL_TYPE_VIDEO
public static final int URL_TYPE_VIDEO
Constant Value: 2 (0x00000002)
Public methods
getCreatorPackageName
public static String getCreatorPackageName (Intent intent)
This method is deprecated.
This return value of this method cannot be trusted, it is kept around for
compatibility. Use getUntrustedCreatorPackageName(Intent)
, or an alternative
method if you rely on the return value.
Parameters | |
---|---|
intent |
Intent |
Returns | |
---|---|
String |
getIntent
public Intent getIntent ()
Gets the Intent of BrowserActionsIntent
.
Returns | |
---|---|
Intent |
the Intent of BrowserActionsIntent .
|
getUntrustedCreatorPackageName
public static String getUntrustedCreatorPackageName (Intent intent)
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
public static void launchIntent (Context context, Intent intent)
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
public static void openBrowserAction (Context context, Uri uri, int type, ArrayList<BrowserActionItem> items, PendingIntent pendingIntent)
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 : 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.
|
openBrowserAction
public static void openBrowserAction (Context context, Uri uri)
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.
|
parseBrowserActionItems
public static List<BrowserActionItem> parseBrowserActionItems (ArrayList<Bundle> bundles)
Gets custom item list for browser action menu.
Parameters | |
---|---|
bundles |
ArrayList : Data for custom items from BrowserActionsIntent . |
Returns | |
---|---|
List<BrowserActionItem> |
List of BrowserActionItem
|
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-30 UTC.