How to determine if my live wallpapers work in preview / "Set wallpaper" or on the desktop

I would like to draw a text message only when the wallpaper is launched from the application to select live wallpapers in preview mode. (With the buttons "Set Wallpaper" and "Settings").

Since I will have a free and paid version, in the free one I would also like to inform the user about the functions of the paid versions or even enable these functions when previewing the wallpaper, but not when it is really running on the main screen, so as not to annoy them.

Any ideas?

Alternatively, I can simply display this information the first time I run the wallpaper, which will always be displayed in preview mode.

+4
source share
2 answers

Do you agree only to check if your wallpaper is installed?

In your implementation of WallpaperService#onCreateEngine() you can do:

 WallpaperManager wpm = (WallpaperManager) getSystemService(WALLPAPER_SERVICE); WallpaperInfo info = wpm.getWallpaperInfo(); if (info != null && info.getComponent().equals(new ComponentName(this, getClass()))) { Log.d(TAG, "We're already running"); // Still might be a preview, but the user is already running your LWP. } else { Log.d(TAG, "We're not running, this should be a preview"); // Should definitely be a preview. } 
+5
source

use isPreview () in your onCreateEngine () method.

+5
source

Source: https://habr.com/ru/post/1402454/


All Articles