Reputation: 247
I'm trying to build a very simple Remote App for my TV.
After some research I found the ConsumerIrManagerClass
, but when I call this.getSystemService("CONSUMER_IR_SERVICE");
I get null
...
The mobile is a Samsung Galaxy S4 so it has an IR Sensor...
Here's the code of my method:
public void btnOnOff_Click(View view) {
String command = "0000 0073 0000 000c 0020 0020 0020 0020 0040 0020 0020 0020 0020 0020 0020 0020 0020 0020 0020 0020 0020 0040 0020 0020 0040 0020 0020 0cbf";
irManager = (ConsumerIrManager) this.getSystemService("CONSUMER_IR_SERVICE");
irManager.transmit(36000, hexToDec(command));
}
Does anyone know how to solve this?
Upvotes: 0
Views: 1269
Reputation: 137
Also to be clear: it is an IR emitter, not a sensor. The sensor is on the equipment you are controlling.
Chances are if you are doing: Context.CONSUMER_IR_SERVICE and you get NULL your phone does not support this feature. Try a free IR app in the Play store first to see if that works.
Upvotes: 0
Reputation: 55370
You should use the Context.CONSUMER_IR_SERVICE
constant as parameter.
It's value is "consumer_ir"
, not "CONSUMER_IR_SERVICE"
.
Upvotes: 1