How to transmit IR signal in Android

Tushar Kathuria picture Tushar Kathuria · Feb 15, 2016 · Viewed 8.9k times · Source

I have the IR sequence available in hexadecimal format which I want to transmit from device on click of a button. I could not find any documentation that explains to implement it with example. Any help would be appreciated.

Edit:

Example hex code: E172E817 (NEC format) This hex code was captured from a projector remote by arduino using adafruit's IR Library

I have tried to transmit it using the following code:

consumerIRManager.transmit(70000,new int[]{57714,59415});

When I run it,there is no error but it does not transmit any IR code.

Answer

pleft picture pleft · Feb 15, 2016

I believe what you need is the AndroidInfrared project on GitHub. It has a specific command to issue NEC Ir commands:

 ConsumerIrManager manager = ConsumerIrManager.getSupportConsumerIrManager(context);

    // Check whether IrEmitter is avaiable on the device.
    if (!manager.hasIrEmitter()) {
        Log.e("AndroidInfraredDemo", "Cannot found IR Emitter on the device");
    }

    // Build IR Command with predefined schemes.
    IrCommand necCommand = IrCommand.NEC.buildNEC(32, 0x723F);
    manager.transmit(necCommand);