I am trying to get the turned on or turned off status of connected out put TV in android box. There is HdmiControlService in android. As there is very less documentation on it. Is there any sample code for it. Any help will be appreciated.I have tried the following code
process = Runtime.getRuntime().exec("echo 'pow 0'| cec-client -s -d 1") bufferedReader = BufferedReader(InputStreamReader(process.inputStream)) log = StringBuilder() if (bufferedReader != null) { while ((bufferedReader.readLine().also { line = it }) != null) { if (line?.contains("power status") == true) { log.append(line) } } HDMI_CEC_ENABLED = log.toString() }