之前没怎么接触过安卓编程,学校实验室要搞个小项目,本来想搞个类似小米遥控板那种的小应用。结果发现百度一下 安卓红外API 找不到有用的东西。自己摸索了半天给大家分享分享
后来在Android开发者文档里面找到了一个叫ConsumerIrManager的类。
先看看文档里面怎么写的:
public final class
ConsumerIrManager
extends Object
Java.lang.Object
android.hardware.ConsumerIrManager
Class Overview
Class that operates consumer infrared on the device.
To obtain an instance of the system infrared transmitter, call Context.getSystemService() with CONSUMER_IR_SERVICE as the argument.
Summary
Nested Classes
class
ConsumerIrManager.CarrierFrequencyRange
Represents a range of carrier frequencies (inclusive) on which the infrared transmitter can transmit
Public Methods
CarrierFrequencyRange[]
getCarrierFrequencies()
Query the infrared transmitter’s supported carrier frequencies
boolean
hasIr