ShareTarget
class ShareTarget
kotlin.Any | |
↳ | androidx.browser.trusted.sharing.ShareTarget |
Describes a Web Share Target associated with a Trusted Web Activity. The structure of a ShareTarget object follows the specification [1] of the "share_target" object within web manifest json, with the following exceptions: - The "action" field specifies the full URL of the Share Target, and not only the path. - There is no "url" field in the "params" object, since urls are not supplied separately from text in Android's ACTION_SEND and ACTION_SEND_MULTIPLE intents. [1] https://wicg.github.io/web-share-target/level-2/
Summary
Nested classes | |
---|---|
Defines a form field for sharing files. |
|
Contains parameter names to be used for the data being shared. |
Constants | |
---|---|
static String |
An encoding type to be used with POST requests (see |
static String |
An encoding type to be used with POST requests (see |
static String |
Bundle key for |
static String |
Bundle key for |
static String |
Bundle key for |
static String |
Bundle key for |
static String |
See |
static String |
See |
Public constructors | |
---|---|
<init>(@NonNull : String, @Nullable : String?, @Nullable : String?, @NonNull : ShareTarget.Params) Creates a |
Public methods | |
---|---|
static ShareTarget? |
fromBundle(@NonNull : Bundle) Unpacks the object from a |
Bundle |
toBundle() Packs the object into a |
Properties | |
---|---|
String |
URL of the Web Share Target. |
String? |
Specifies how the shared data should be encoded in the body of a POST request. |
String? |
HTTP request method for the Web Share Target. |
ShareTarget.Params |
Contains the parameter names, see |
Constants
ENCODING_TYPE_MULTIPART
static val ENCODING_TYPE_MULTIPART: String
An encoding type to be used with POST requests (see encodingType
) corresponding to multipart/form-data
of the HTTP POST standard [1].
Value: "multipart/form-data"
ENCODING_TYPE_URL_ENCODED
static val ENCODING_TYPE_URL_ENCODED: String
An encoding type to be used with POST requests (see encodingType
) corresponding to application/x-www-form-urlencoded
of the HTTP POST standard [1]. [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST
Value: "application/x-www-form-urlencoded"
KEY_ACTION
static val KEY_ACTION: String
Bundle key for action
.
Value: "androidx.browser.trusted.sharing.KEY_ACTION"
KEY_ENCTYPE
static val KEY_ENCTYPE: String
Bundle key for encodingType
.
Value: "androidx.browser.trusted.sharing.KEY_ENCTYPE"
KEY_METHOD
static val KEY_METHOD: String
Bundle key for method
.
Value: "androidx.browser.trusted.sharing.KEY_METHOD"
KEY_PARAMS
static val KEY_PARAMS: String
Bundle key for params
.
Value: "androidx.browser.trusted.sharing.KEY_PARAMS"
Public constructors
<init>
ShareTarget(
@NonNull : String,
@Nullable : String?,
@Nullable : String?,
@NonNull : ShareTarget.Params)
Creates a ShareTarget
with the given parameters.
Parameters | |
---|---|
action |
String: The action . |
method |
String?: The method . |
encodingType |
String?: The encodingType . |
params |
ShareTarget.Params: The params . |
Public methods
fromBundle
@Nullable static fun fromBundle(@NonNull : Bundle): ShareTarget?
Unpacks the object from a Bundle
.
Properties
action
@NonNull val action: String
URL of the Web Share Target. Must belong to an origin associated with the Trusted Web Activity. For example, assuming the origin is "https://mypwa.com", the action could be "https://mypwa.com/share.html".
encodingType
@Nullable val encodingType: String?
Specifies how the shared data should be encoded in the body of a POST request. Must be ENCODING_TYPE_MULTIPART
or ENCODING_TYPE_URL_ENCODED
. Default is ENCODING_TYPE_URL_ENCODED
.
method
@Nullable val method: String?
HTTP request method for the Web Share Target. Must be METHOD_GET
or METHOD_POST
. Default is METHOD_GET
.