Stay organized with collections
Save and categorize content based on your preferences.
KeyRequest
class 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
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
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
static val REQUEST_TYPE_RELEASE: Int
Key request type is license release
Value: 2
REQUEST_TYPE_RENEWAL
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
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
fun getData(): ByteArray
Get the opaque message data
getDefaultUrl
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 . |
getRequestType
fun getRequestType(): Int
Get the type of the request
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MediaDrm.KeyRequest\n\nAdded in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nKeyRequest\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaDrm.KeyRequest \"View this page in Java\") \n\n```\nclass KeyRequest\n```\n\n|---|----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.MediaDrm.KeyRequest](#) |\n\nContains 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.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [REQUEST_TYPE_INITIAL](#REQUEST_TYPE_INITIAL:kotlin.Int) Key request type is initial license request. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [REQUEST_TYPE_NONE](#REQUEST_TYPE_NONE:kotlin.Int) Keys are already loaded and are available for use. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [REQUEST_TYPE_RELEASE](#REQUEST_TYPE_RELEASE:kotlin.Int) Key request type is license release |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [REQUEST_TYPE_RENEWAL](#REQUEST_TYPE_RENEWAL:kotlin.Int) Key request type is license renewal. |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [REQUEST_TYPE_UPDATE](#REQUEST_TYPE_UPDATE:kotlin.Int) Keys have been loaded but an additional license request is needed to update their values. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | [getData](#getData())`()` Get the opaque message data |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getDefaultUrl](#getDefaultUrl())`()` Get the default URL to use when sending the key request message to a server, if known. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getRequestType](#getRequestType())`()` Get the type of the request |\n\nConstants\n---------\n\n### REQUEST_TYPE_INITIAL\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val REQUEST_TYPE_INITIAL: Int\n```\n\nKey request type is initial license request. A license request is necessary to load keys. \n\n Value: 0\n\n### REQUEST_TYPE_NONE\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val REQUEST_TYPE_NONE: Int\n```\n\nKeys are already loaded and are available for use. No license request is necessary, and no key request data is returned. \n\n Value: 3\n\n### REQUEST_TYPE_RELEASE\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val REQUEST_TYPE_RELEASE: Int\n```\n\nKey request type is license release \n\n Value: 2\n\n### REQUEST_TYPE_RENEWAL\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val REQUEST_TYPE_RENEWAL: Int\n```\n\nKey request type is license renewal. A license request is necessary to prevent the keys from expiring. \n\n Value: 1\n\n### REQUEST_TYPE_UPDATE\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val REQUEST_TYPE_UPDATE: Int\n```\n\nKeys have been loaded but an additional license request is needed to update their values. \n\n Value: 4\n\nPublic methods\n--------------\n\n### getData\n\nAdded in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getData(): ByteArray\n```\n\nGet the opaque message data\n\n| Return ||\n|-----------------------------------------------------------------------------------------|------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | This value cannot be `null`. |\n\n### getDefaultUrl\n\nAdded in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getDefaultUrl(): String\n```\n\nGet 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.\n\n| Return ||\n|----------------------------------------------------------------------------------|------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | This value cannot be `null`. |\n\n### getRequestType\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getRequestType(): Int\n```\n\nGet the type of the request\n\n| Return ||\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is [android.media.MediaDrm.KeyRequest#REQUEST_TYPE_INITIAL](#REQUEST_TYPE_INITIAL:kotlin.Int), [android.media.MediaDrm.KeyRequest#REQUEST_TYPE_RENEWAL](#REQUEST_TYPE_RENEWAL:kotlin.Int), [android.media.MediaDrm.KeyRequest#REQUEST_TYPE_RELEASE](#REQUEST_TYPE_RELEASE:kotlin.Int), [android.media.MediaDrm.KeyRequest#REQUEST_TYPE_NONE](#REQUEST_TYPE_NONE:kotlin.Int), or [android.media.MediaDrm.KeyRequest#REQUEST_TYPE_UPDATE](#REQUEST_TYPE_UPDATE:kotlin.Int) |"]]