Android如何查看设备是否有红外线?
How to check if device has infra-red in Android?
我如何实用地知道设备在 android 中是否有红外线硬件?
我想在此基础上做一些事情。我尝试使用类似下面的东西,但没有运气。
this.getPackageManager().hasSystemFeature( .. various constants ..)
尝试以下代码
科特林:
val irManager: ConsumerIrManager = getSystemService(CONSUMER_IR_SERVICE) as ConsumerIrManager
// Check whether IrEmitter is available on the device.
if (irManager.hasIrEmitter()) {
Log.i("IR_Testing", "found IR Emitter")
}else{
Log.i("IR_Testing", "Cannot found IR Emitter on the device")
}
Java:
private ConsumerIrManager irManager ;
irManager = (ConsumerIrManager) getSystemService(CONSUMER_IR_SERVICE);
if (irManager.hasIrEmitter()) {
Log.i("IR_Testing", "found IR Emitter");
} else {
Log.i("IR_Testing", "Cannot found IR Emitter on the device");
}
我如何实用地知道设备在 android 中是否有红外线硬件?
我想在此基础上做一些事情。我尝试使用类似下面的东西,但没有运气。
this.getPackageManager().hasSystemFeature( .. various constants ..)
尝试以下代码
科特林:
val irManager: ConsumerIrManager = getSystemService(CONSUMER_IR_SERVICE) as ConsumerIrManager
// Check whether IrEmitter is available on the device.
if (irManager.hasIrEmitter()) {
Log.i("IR_Testing", "found IR Emitter")
}else{
Log.i("IR_Testing", "Cannot found IR Emitter on the device")
}
Java:
private ConsumerIrManager irManager ;
irManager = (ConsumerIrManager) getSystemService(CONSUMER_IR_SERVICE);
if (irManager.hasIrEmitter()) {
Log.i("IR_Testing", "found IR Emitter");
} else {
Log.i("IR_Testing", "Cannot found IR Emitter on the device");
}