There's no possibility to open preview of screensaver like for a live wallpaper so I'd like to provide a shortcut for users to open TV's settings and manually set screensaver.
Currently I open system settings with intent action android.settings.SETTINGS
which opens root device settings.
On phones I can start android.settings.DREAM_SETTINGS
(it is described in docs here) which opens corresponding settings section. But this doesn't work on TV (tried on emulator). Is it possible to open it on Android TV?
I've found a way to launch this activity in the source code of "Aerial Dream" screensaver: https://github.com/cachapa/AerialDream/blob/master/app/src/main/java/com/codingbuffalo/aerialdream/SettingsFragment.java#L29
// Check if the daydream intent is available - some devices (e.g. NVidia Shield) do not support it
Intent intent = new Intent(SCREENSAVER_SETTINGS);
if (!intentAvailable(intent)) {
// Try opening the daydream settings activity directly: https://gist.github.com/reines/bc798a2cb539f51877bb279125092104
intent = new Intent(Intent.ACTION_MAIN).setClassName("com.android.tv.settings", "com.android.tv.settings.device.display.daydream.DaydreamActivity");
if (!intentAvailable(intent)) {
// If all else fails, open the normal settings screen
intent = new Intent(SETTINGS);
}
}
startActivity(intent);
private boolean intentAvailable(Intent intent) {
PackageManager manager = getActivity().getPackageManager();
List<ResolveInfo> infos = manager.queryIntentActivities(intent, 0);
return !infos.isEmpty();
}