Prevent changing screen settings Live Wallpaper

I am working on Live Wallpaper, and I would like to keep it always in portrait mode. I know that for Activity, you can declare orientation in the manifest, but I cannot find a way to do the same using the live wallpaper service. Is it possible to somehow get the browser to bypass the x and y axes during the rendering process or something like that because I don't know anything else.

+4
source share
2 answers

Use the following method to check orientation changes.

public void onSurfaceChanged(SurfaceHolder holder, int format, int width, int height) 

If the width is greater than the height, you know that the orientation has changed to landscape.

Make sure you now treat x as y and y as x. The same goes for width and height.

+2
source

You have a change of orientation for live wallpapers. you cannot fix the orientation.

0
source

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


All Articles