MediaDrm.KeyRequest


public static final class MediaDrm.KeyRequest
extends Object

java.lang.Object
   ↳ android.media.MediaDrm.KeyRequest


Contains the opaque data an app uses to request keys from a license server. These request types may or may not be generated by a given plugin. Refer to plugin vendor documentation for more information.

Summary

Constants

int REQUEST_TYPE_INITIAL

Key request type is initial license request.

int REQUEST_TYPE_NONE

Keys are already loaded and are available for use.

int REQUEST_TYPE_RELEASE

Key request type is license release

int REQUEST_TYPE_RENEWAL

Key request type is license renewal.

int REQUEST_TYPE_UPDATE

Keys have been loaded but an additional license request is needed to update their values.

Public methods

byte[] getData()

Get the opaque message data

String getDefaultUrl()

Get the default URL to use when sending the key request message to a server, if known.

int getRequestType()

Get the type of the request

Inherited methods

Constants

REQUEST_TYPE_INITIAL

Added in API level 23
public static final int REQUEST_TYPE_INITIAL

Key request type is initial license request. A license request is necessary to load keys.

Constant Value: 0 (0x00000000)

REQUEST_TYPE_NONE

Added in API level 28
public static final int REQUEST_TYPE_NONE

Keys are already loaded and are available for use. No license request is necessary, and no key request data is returned.

Constant Value: 3 (0x00000003)

REQUEST_TYPE_RELEASE

Added in API level 23
public static final int REQUEST_TYPE_RELEASE

Key request type is license release

Constant Value: 2 (0x00000002)

REQUEST_TYPE_RENEWAL

Added in API level 23
public static final int REQUEST_TYPE_RENEWAL

Key request type is license renewal. A license request is necessary to prevent the keys from expiring.

Constant Value: 1 (0x00000001)

REQUEST_TYPE_UPDATE

Added in API level 28
public static final int REQUEST_TYPE_UPDATE

Keys have been loaded but an additional license request is needed to update their values.

Constant Value: 4 (0x00000004)

Public methods

getData

Added in API level 18
public byte[] getData ()

Get the opaque message data

Returns
byte[] This value cannot be null.

getDefaultUrl

Added in API level 18
public String getDefaultUrl ()

Get the default URL to use when sending the key request message to a server, if known. The app may prefer to use a different license server URL from other sources. This method returns an empty string if the default URL is not known.

Returns
String This value cannot be null.

getRequestType

Added in API level 23
public int getRequestType ()

Get the type of the request

Returns
int Value is REQUEST_TYPE_INITIAL, REQUEST_TYPE_RENEWAL, REQUEST_TYPE_RELEASE, REQUEST_TYPE_NONE, or REQUEST_TYPE_UPDATE