0

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?

toniedzwiedz
18.7k10 gold badges90 silver badges137 bronze badges
asked May 24, 2014 at 21:31
1
  • Use Context.CONSUMER_IR_SERVICE instead of a hard coded string. You may be using the wrong one. Commented May 24, 2014 at 21:40

2 Answers 2

1

You should use the Context.CONSUMER_IR_SERVICE constant as parameter.

It's value is "consumer_ir", not "CONSUMER_IR_SERVICE".

answered May 24, 2014 at 21:51
Sign up to request clarification or add additional context in comments.

Comments

0

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.

answered Apr 29, 2015 at 22:35

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.