Stack Overflow Asked by keaukraine on December 18, 2021
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?
Just in case somebody looks for launching screensaver on Nvidia Shield.
The intent name is com.android.systemui/.Somnambulator
.
If using Button Mapper app, use "Broadcase Intent" with "Package": com.android.systemui
and "Component": com.android.systemui.Somnambulator
.
Answered by Aivean on December 18, 2021
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();
}
Answered by keaukraine on December 18, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP