Skip to content

Instantly share code, notes, and snippets.

@frankkienl
Last active December 19, 2015 13:49
Show Gist options
  • Save frankkienl/5965105 to your computer and use it in GitHub Desktop.
Save frankkienl/5965105 to your computer and use it in GitHub Desktop.
How to start the OUYA Discover and OldDiscover.
/**
* This is how we can start OldDiscoverActivity
* This is possible because OldDiscoverActivity has an Intent-Filter in the AndroidManifest.XML
*/
Intent i = new Intent();
//i.setClassName("tv.ouya.console", "tv.ouya.console.launcher.store.adapter.DiscoverActivity");
i.setClassName("tv.ouya.console", "tv.ouya.console.launcher.store.OldDiscoverActivity");
try {
startActivity(i);
} catch (Exception e) {
ShowException.showException(e, DiscoverTestActivity.this);
}
/**
* This is how we have to start the new DiscoverActivity
* We have to use ROOT because DiscoveryActivity does not have an Intent-filter.
* That makes the Activity 'private'.
* That is why we have to use the ActivityManager and ROOT to start it.
*
* This only works on OUYA's with SuperUser or SuperSU, because the stock su-binary
* seems to work only over USB.
*/
private class StartDiscoverRootAsyncTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
// Let's do some SU stuff
boolean suAvailable = Shell.SU.available();
if (suAvailable) {
//String suVersion = Shell.SU.version(false);
//String suVersionInternal = Shell.SU.version(true);
List<String> suResult = Shell.SU.run(new String[]{
"am start --user 0 -n tv.ouya.console/tv.ouya.console.launcher.store.adapter.DiscoverActivity"
});
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment