Android 4.4 has an API for devices with built in IR transmitters such as the HTC One and many Samsung models. I am modifing my app to work with this.
Dim IR As Reflector
IR.target=IR.getcontext
IR.target = IR.RunMethod2("getSystemService", "consumer_ir", "java.lang.String")
if IR.RunMethod("hasIrEmitter") then 'returns true on my HTC one
Dim test As Object = IR.GetMethod("getCarrierFrequencies", types) 'works
test = IR.GetMethod("transmit", Types) 'error java.lang.NoSuchMethodException: transmit []
The above code works up to the last line. The transmit method is documented here:
http://developer.android.com/reference/android/hardware/ConsumerIrManager.html#transmit(int, int[])
If I call the transmit function with Runmethod4 I get the same error. Does anybody know what I might be doing wrong?
IR.Runmethod4 ("transmit", Array As Object(Freq, pattern), Array As String("java.lang.int", "java.lang.int"))
public void transmit (int carrierFrequency, int[] pattern)
Added in API level 19
Transmit and infrared pattern
This method is synchronous; when it returns the pattern has been transmitted. Only patterns shorter than 2 seconds will be transmitted.
Parameters
carrierFrequency The IR carrier frequency in Hertz.
pattern The alternating on/off pattern in microseconds to transmit.
Dim IR As Reflector
IR.target=IR.getcontext
IR.target = IR.RunMethod2("getSystemService", "consumer_ir", "java.lang.String")
if IR.RunMethod("hasIrEmitter") then 'returns true on my HTC one
Dim test As Object = IR.GetMethod("getCarrierFrequencies", types) 'works
test = IR.GetMethod("transmit", Types) 'error java.lang.NoSuchMethodException: transmit []
The above code works up to the last line. The transmit method is documented here:
http://developer.android.com/reference/android/hardware/ConsumerIrManager.html#transmit(int, int[])
If I call the transmit function with Runmethod4 I get the same error. Does anybody know what I might be doing wrong?
IR.Runmethod4 ("transmit", Array As Object(Freq, pattern), Array As String("java.lang.int", "java.lang.int"))
public void transmit (int carrierFrequency, int[] pattern)
Added in API level 19
Transmit and infrared pattern
This method is synchronous; when it returns the pattern has been transmitted. Only patterns shorter than 2 seconds will be transmitted.
Parameters
carrierFrequency The IR carrier frequency in Hertz.
pattern The alternating on/off pattern in microseconds to transmit.