Added in API level 18

KeyRequest

class KeyRequest
kotlin.Any
   ↳ 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
static Int

Key request type is initial license request.

static Int

Keys are already loaded and are available for use.

static Int

Key request type is license release

static Int

Key request type is license renewal.

static Int

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

Public methods
ByteArray

Get the opaque message data

String

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

Int

Get the type of the request

Constants

REQUEST_TYPE_INITIAL

Added in API level 23
static val REQUEST_TYPE_INITIAL: Int

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

Value: 0

REQUEST_TYPE_NONE

Added in API level 28
static val REQUEST_TYPE_NONE: Int

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

Value: 3

REQUEST_TYPE_RELEASE

Added in API level 23
static val REQUEST_TYPE_RELEASE: Int

Key request type is license release

Value: 2

REQUEST_TYPE_RENEWAL

Added in API level 23
static val REQUEST_TYPE_RENEWAL: Int

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

Value: 1

REQUEST_TYPE_UPDATE

Added in API level 28
static val REQUEST_TYPE_UPDATE: Int

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

Value: 4

Public methods

getData

Added in API level 18
fun getData(): ByteArray

Get the opaque message data

Return
ByteArray This value cannot be null.

getDefaultUrl

Added in API level 18
fun getDefaultUrl(): String

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.

Return
String This value cannot be null.