2

This question has been asked before, but with no answer.

Is it possible to force a live wallpaper to display in portrait mode at all times, ignoring orientation changes? As there is no activity, I cannot do this the normal way.

Thanks!

Matt
  • 63
  • 8
  • possible duplicate of ["fixing" a live wallpaper in portrait mode](http://stackoverflow.com/questions/6827096/fixing-a-live-wallpaper-in-portrait-mode) – Shoban Nov 11 '11 at 06:28

1 Answers1

0

Yes, it is possible but it's tricky. You can't avoid orientation changes in your code for you'll have to rotate your wallpaper in order to always have it in portrait mode.

Have width and height monitored in

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

method of a

android.service.wallpaper.WallpaperService.Engine

class. It gets called every time the orientation changes. If width is greater than height then you'll most probably in landscape mode.

Then just treat x as y and width as height and rotate any bitmaps you have. This should work.

Alehar
  • 639
  • 5
  • 16