Solving ConsumerIrManager issues
before KitKat Jul 4, 2014


The ConsumerIrManager class method "transmit(intcarrierFrequency, int[] pattern)" does not work properly in versions of Android prior to 4.4.3.s


The transmit method does not work in Android 4.4.3.


The "pattern" array in "transmit (intcarrierFrequency, int[] pattern)" alternates between on/off patterns and each pattern duration is in microseconds. However, pattern in Samsung devices using versions older than Android 4.4.3 KitKat is expressed as the number of cycles (i.e. periods) of the carrier frequency. Implementing the method according to the API guide based on this difference will result in malfunctions on Samsung devices using Android versions older than 4.4.3.

Figure 1. e.g. 40 KHz carrier frequency, period = 1sec/40000 = 25us


In order to use transmit in older Android versions, pattern must be expressed as the number of cycles in the carrier frequency and Build.VERSION.RELEASE must be used in order to differentiate from versions later than 4.4.3.

The following shows how to differentiate versions to properly support both older and later versions.

mConIrMgr = (ConsumerIrManager) this.getSystemService(Context.CONSUMER_IR_SERVICE);

private static final int SAMPLE_FREQ = 38400;
private static final int[] IR_SIGNAL_PULSE_COUNT = {171,171,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,21,22,21,22,21,22,21,22,64,22,64,22,21,22,64,22,64,22,64,22,64,22,64,22,876};
private static final int[] IR_SIGNAL_TIME_LENGTH = {4499,4499,578,1683,578,1683,578,1683,578,552,578,552,578,552,578,552,578,552,578,1683,578,1683,578,1683,578,552,578,552,578,552,578,552,578,552,578,552,578,552,578,1683,578,552,578,552,578,552,578,552,578,552,578,1683,578,1683,578,552,578,1683,578,1683,578,1683,578,1683,578,1683,578,23047};

// Version has same format (Major .Minor . MR)
    intlastIdx = Build.VERSION.RELEASE.lastIndexOf(".");
    int VERSION_MR = Integer.valueOf(Build.VERSION.RELEASE.substring(lastIdx+1));
    if (VERSION_MR < 3) { 
        // Before version of Android 4.4.2
        mConIrMgr.transmit(SAMPLE_FREQ, IR_SIGNAL_PULSE_COUNT);
    } else { 
        // Later version of Android 4.4.3
        mConIrMgr.transmit(SAMPLE_FREQ, IR_SIGNAL_TIME_LENGTH);


All applications currently supported in Samsung devices define pattern as the number of cycles in the carrier frequency. This causes malfunctions in versions later than Android 4.4.3. The above workaround must be applied for applications to operate properly after upgrading to Android 4.4.3 or later.