2011年10月30日 星期日

[AndroidDev] Live Wallpaper

  • Very similar to a Service.
  • The only difference is the addition of a new method, onCreateEngine(), whose goal is to create a WallpaperService.Engine.

WallpaperService.Engine
  • The engine is responsible for handling the lifecycle and drawing of a wallpaper.
  • The system provides a surface on which you can draw, just like you would with a SurfaceView.
  • The engine can also implement several methods to interact with the user or the home application.

Performance
  • The most important part of the lifecycle of a wallpaper is when it becomes visible, as indicated by a call to onVisibilityChanged().
  • When invisible, such as when the user launches an application that covers the home screen, a wallpaper must stop all activity.
  • 所以必須優化繪圖的內容及管理好 wallpaper 的 lifecycle,以達到以下改善:
    • To avoid using too much CPU.
    • Survive the battery life.
    • To avoid slowing down the rest of the system.

Configurations
  • <uses-sdk android:minSdkVersion="7" />
    • which indicates to Android Market and the platform that your application requires Android 2.1 or higher.
  • <uses-feature android:name="android.software.live_wallpaper" />


Pending Study
  • Draw content for wallpaper. 


* Reference 
- Live Wallpapers | Android Developers

沒有留言:

張貼留言