[This remote](https://play.google.com/store/apps/details?id=com.remotefairy&hl=en) is widely accepted as being incredibly up to date, and compatible with hundreds of devices. It is not free, but there is a free version. 

Something like [this app](https://play.google.com/store/apps/details?id=remote.control.samsung) lets you add codes for various devices. 

In terms of programming, this would be off topic here, but since there might be alternatives you can use I've answered this. You could use the Android SDK and write an IR app yourself using the [Andrid 4.4 APIs](https://developer.android.com/about/versions/android-4.4.html). 

> Infrared transmitters

> When running on a device that includes an infrared (IR) transmitter, you can now transmit IR signals using the `ConsumerIrManager` APIs. To get an instance of `ConsumerIrManager`, call `getSystemService()` with `CONSUMER_IR_SERVICE` as the argument. You can then query the device's supported IR frequencies with `getCarrierFrequencies()` and transmit signals by passing your desired frequency and signal pattern with transmit().

> You should always first check whether a device includes an IR transmitter by calling `hasIrEmitter()`, but if your app is compatible only with devices that do have one, you should include a `<uses-feature>` element in your manifest for `"android.hardware.consumerir" (FEATURE_CONSUMER_IR)`.


(Note: I have zero involvement with any of the apps listed)