I am trying to make an IR emitter app for android, just for fun. I am new to android programming with Kotlin. Whenever I run this app on my phone the app force closes.
val mCIR = getSystemService(Context.CONSUMER_IR_SERVICE) as ConsumerIrManager
val freq : Int = 38000
val signal : IntArray = intArrayOf(339,158,19,60,19,20,19,20,19,20,19,60,19,20,19,20,19,20,19,
60,19,60,19,20,19,20,19,20,19,20,19,20,19,20,19,20,19,20,19,20,19,
20,19,20,19,60,19,20,19,60,19,20,19,20,19,20,19,60,19,3768)
pow1.setOnClickListener{
mCIR.transmit(freq, signal)
}
}
This is the link to the logcat from my device
https://send.firefox.com/download/7ed978957bc24c30/#GFKDhp22ap3qV-6TjTurGg
You can initialize it like this
val value = getSystemService(Context.CONSUMER_IR_SERVICE) as ConsumerIrManager