[removed on request of the openHAB Foundation]
I just installed the latest snapshot (2.7), but the problem with my Chromecast with Google TV still persists. I am guessing it is the same issue as discribed here:
I cannot get the current package via the corresponding channel, the string is always “NULL”. Starting a package works fine though.
I see this warning in the log:
16:55:11.787 [WARN ] [ge.internal.AndroidDebugBridgeHandler] - Unable to refresh current package: Device does not s
upport current-package:
16:55:11.869 [WARN ] [ge.internal.AndroidDebugBridgeHandler] - Unable to refresh play status: Device does not suppo
rt current-package:
Am I missing something or is this a bug?
Looks like a missing feature.
Anything I can do to get this missing feature?
Unfortunately I am not an experienced programmer, but I am always happy to play the guinea pig when it comes to testing new beta versions…
I did a lot of googeling and played around a little bit with the source code (of the original binding in openhab 3.1) and I managed to get things working on my Google TV with Chromecast. This is just a very quick & even dirtier solution (as I said, I am not a real programmer and know close to no Java ), but maybe it helps fixing this issue in a future release…
Here is what I did:
public String getCurrentPackage() throws AndroidDebugBridgeDeviceException, InterruptedException,
AndroidDebugBridgeDeviceReadException, TimeoutException, ExecutionException {
var out = runAdbShell("dumpsys", "activity", "recents", "|", "grep", "'Recent #0'", "|", "cut", "-d=", "-f2",
"|", "sed", "'s|", ".*||'", "|", "cut", "-d", "'/'", "-f1");
var packageActivityName = out;
return packageActivityName;
}
Also, I found a problem with starting certain apps (like e.g. Amazon Video), more infos here. I fixed it like this:
public void startPackage(String packageName)
throws InterruptedException, AndroidDebugBridgeDeviceException, TimeoutException, ExecutionException {
if (!PACKAGE_NAME_PATTERN.matcher(packageName).matches()) {
logger.warn("{} is not a valid package name", packageName);
return;
}
var out = runAdbShell("monkey", "--pct-syskeys", "0", "-p", packageName, "-v", "1");
if (out.contains("monkey aborted")) {
out = runAdbShell("monkey", "--pct-syskeys", "0", "-p", packageName, "-c",
"android.intent.category.LEANBACK_LAUNCHER", "1");
}
}