[AndroidTV] Simple OSD Remote
Posted: Saturday 09 January 2016 22:00
My first app for Android or even Java, designed for the AndroidTV, its so stupid simple but it involves Domoticz so I'll share:
Source Code: https://github.com/nayrnet/androidtv-osd-remote

A prebuilt package wont be much use to anyone its all hardcoded values, I ripped it off from: https://github.com/bsara/reboot-android-tv
I had this functionality when I ran a big media center pc, hacked the Plex Home Theatre theme to send commands to domoticz and change inputs from the main menu.. but when I moved to Android for better power consumption I lost this functionality, that is until last night.
I have a lil bit more stuff I want to add, mainly a popup window after changing input that says press OK to switch back.. so when I switch to a gaming console or turn TV off I can go back to the nexus player (and domo will turn tv back on if needed) later by just pressing the enter button on the nexus remote twice (once to wake it up and once to close dialog).. Now I just need a wireless volume nob of some sort and I can ditch the universal remote.
I dont plan on making it customizable or any of that stuff, already spent too much time on this really and I dont want anyone (toddlers) mucking about in a settings menu now that it works. I run the AndroidTV restricted profile with minimal apps to keep the kids out. I will clean it up and post it to github shortly so if you want to hack it and build your own version you can.. its pretty easy, the android devel kit is pretty slick.. Consider it a sample program you can quickly modify for your unique setup, adding/removing/modifying buttons and changing the feel is pretty easy, I figured it out in a few hours, and most of that was spent blindly not realizing that my emulation environment lacked network access, thus all calls to domo failed, sideloaded it on the nexus player and wam.. worked fine.
If demand is high enough I may be convinced to spend bit more time on it in the future.. but I'd really like someone to pick this up and run with it.
here is a sniplet of code to show how simple it is:
Source Code: https://github.com/nayrnet/androidtv-osd-remote

A prebuilt package wont be much use to anyone its all hardcoded values, I ripped it off from: https://github.com/bsara/reboot-android-tv
I had this functionality when I ran a big media center pc, hacked the Plex Home Theatre theme to send commands to domoticz and change inputs from the main menu.. but when I moved to Android for better power consumption I lost this functionality, that is until last night.
I have a lil bit more stuff I want to add, mainly a popup window after changing input that says press OK to switch back.. so when I switch to a gaming console or turn TV off I can go back to the nexus player (and domo will turn tv back on if needed) later by just pressing the enter button on the nexus remote twice (once to wake it up and once to close dialog).. Now I just need a wireless volume nob of some sort and I can ditch the universal remote.
I dont plan on making it customizable or any of that stuff, already spent too much time on this really and I dont want anyone (toddlers) mucking about in a settings menu now that it works. I run the AndroidTV restricted profile with minimal apps to keep the kids out. I will clean it up and post it to github shortly so if you want to hack it and build your own version you can.. its pretty easy, the android devel kit is pretty slick.. Consider it a sample program you can quickly modify for your unique setup, adding/removing/modifying buttons and changing the feel is pretty easy, I figured it out in a few hours, and most of that was spent blindly not realizing that my emulation environment lacked network access, thus all calls to domo failed, sideloaded it on the nexus player and wam.. worked fine.
If demand is high enough I may be convinced to spend bit more time on it in the future.. but I'd really like someone to pick this up and run with it.
here is a sniplet of code to show how simple it is:
Code: Select all
public void execAction(View selectedView) {
switch (selectedView.getId()) {
case R.id.main_actionItem_ipcameras:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchlight&idx=127&switchcmd=On");
this.finish();
break;
case R.id.main_actionItem_ps3:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchlight&idx=101&switchcmd=On");
this.finish();
break;
case R.id.main_actionItem_ps4:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchlight&idx=102&switchcmd=On");
this.finish();
break;
case R.id.main_actionItem_poweroff:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchlight&idx=104&switchcmd=Off");
this.finish();
break;
case R.id.main_actionItem_mute:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchlight&idx=105&switchcmd=Toggle");
this.finish();
break;
case R.id.main_actionItem_dim:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchscene&idx=5&switchcmd=On");
this.finish();
break;
case R.id.main_actionItem_lightsout:
new AsyncHttpTask().execute("http://192.168.254.33:8080/json.htm?type=command¶m=switchscene&idx=6&switchcmd=Off");
this.finish();
break;
default:
this.finish();
break;
}