Stay organized with collections
Save and categorize content based on your preferences.
ConsumerIrManager
class ConsumerIrManager
Class that operates consumer infrared on the device.
Requires the PackageManager#FEATURE_CONSUMER_IR
feature which can be detected using PackageManager.hasSystemFeature(String)
.
Summary
Nested classes |
|
Represents a range of carrier frequencies (inclusive) on which the infrared transmitter can transmit
|
Public methods
hasIrEmitter
fun hasIrEmitter(): Boolean
Check whether the device has an infrared emitter.
Return |
Boolean |
true if the device has an infrared emitter, else false. |
transmit
fun transmit(
carrierFrequency: Int,
pattern: IntArray!
): Unit
Transmit an infrared pattern
This method is synchronous; when it returns the pattern has been transmitted. Only patterns shorter than 2 seconds will be transmitted.
Parameters |
carrierFrequency |
Int: The IR carrier frequency in Hertz. |
pattern |
IntArray!: The alternating on/off pattern in microseconds to transmit. |
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,["# ConsumerIrManager\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nConsumerIrManager\n=================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/hardware/ConsumerIrManager \"View this page in Java\") \n\n```\nclass ConsumerIrManager\n```\n\n|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.hardware.ConsumerIrManager](#) |\n\nClass that operates consumer infrared on the device. \nRequires the [PackageManager#FEATURE_CONSUMER_IR](../content/pm/PackageManager.html#FEATURE_CONSUMER_IR:kotlin.String) feature which can be detected using [PackageManager.hasSystemFeature(String)](../content/pm/PackageManager.html#hasSystemFeature(kotlin.String)).\n\nSummary\n-------\n\n| Nested classes ||\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [CarrierFrequencyRange](/reference/kotlin/android/hardware/ConsumerIrManager.CarrierFrequencyRange) Represents a range of carrier frequencies (inclusive) on which the infrared transmitter can transmit |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003c[ConsumerIrManager.CarrierFrequencyRange](/reference/kotlin/android/hardware/ConsumerIrManager.CarrierFrequencyRange)!\\\u003e! | [getCarrierFrequencies](#getCarrierFrequencies())`()` Query the infrared transmitter's supported carrier frequencies |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [hasIrEmitter](#hasIrEmitter())`()` Check whether the device has an infrared emitter. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [transmit](#transmit(kotlin.Int,%20kotlin.IntArray))`(`carrierFrequency:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `pattern:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!`)` Transmit an infrared pattern |\n\nPublic methods\n--------------\n\n### getCarrierFrequencies\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getCarrierFrequencies(): Array\u003cConsumerIrManager.CarrierFrequencyRange!\u003e!\n```\n\nQuery the infrared transmitter's supported carrier frequencies\n\n| Return ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003c[ConsumerIrManager.CarrierFrequencyRange](/reference/kotlin/android/hardware/ConsumerIrManager.CarrierFrequencyRange)!\u003e! | an array of [android.hardware.ConsumerIrManager.CarrierFrequencyRange](/reference/kotlin/android/hardware/ConsumerIrManager.CarrierFrequencyRange) objects representing the ranges that the transmitter can support, or null if there was an error communicating with the Consumer IR Service. |\n\n### hasIrEmitter\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun hasIrEmitter(): Boolean\n```\n\nCheck whether the device has an infrared emitter.\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the device has an infrared emitter, else false. |\n\n### transmit\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun transmit(\n carrierFrequency: Int, \n pattern: IntArray!\n): Unit\n```\n\nTransmit an infrared pattern\n\nThis method is synchronous; when it returns the pattern has been transmitted. Only patterns shorter than 2 seconds will be transmitted.\n\n| Parameters ||\n|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `carrierFrequency` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The IR carrier frequency in Hertz. |\n| `pattern` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!: The alternating on/off pattern in microseconds to transmit. |"]]