Tuesday, January 12, 2010

Creating an Android 2.1 Live Wallpaper

Quick disclaimer: this isn't a tutorial, but a brief guide of what Live Wallpapers actually are and how I went about creating 'Duck Paper' - my first Android 2.1 Live Wallpaper. There are tutorials here, from Arno den Hond and here, from AndroGames.net

The Android 2.1 SDK was released today and the only major update was Live Wallpapers, so I thought I'd better find out what they are all about. What I found was quite surprising, I'd imagined that they would be some sort of animation or video playing on the desktop, a bit like MS DreamScene, but actually they are more akin to a an Android application open as the desktop. Live Wallpapers extend the WallpaperService class and the animations and interactions are handled in code, just like in a game. Realising this it seemed reasonable to try and port the only game I've written for Android, Duck Hunt, into a Live Wallpaper.

After less than an hour the first version of 'Duck Paper' was ready - as the ducks fly past in the background you can touch them to shoot them, then they fall off the screen.

Fortunately there is an example Live Wallpaper in the 2.1 SDK called CubeLiveWallpaper. This is definitely the starting point for anyone looking to create their own Live Wallpaper. I opened up this sample project, played with CubeLiveWallpaper1 and merged its Engine with Duck Hunt's SurfaceView code, et voila we have a Live Wallpaper.

Unfortunately I don't have an Android 2.1 device to try it on and it runs pretty slowly in the emulator. Once I've had it tested on a real device I'll put it in the Android Market.

Update: I've had it tested by a friend with a Nexus One and all seems well, so it is now live in the Android Market


Anonymous said...

live wallpaper tutorial with some code


mbaird said...
This comment has been removed by the author.
Anonymous said...

You may probably be very interested to know how one can manage to receive high yields on investments.
There is no need to invest much at first.
You may commense to get income with a money that usually goes
on daily food, that's 20-100 dollars.
I have been participating in one company's work for several years,
and I'm ready to let you know my secrets at my blog.

Please visit my pages and send me private message to get the info.

P.S. I earn 1000-2000 per daily now.

[url=http://theinvestblog.com] Online investment blog[/url]

Android tutorial said...

A full tutorial with archetypes is available here : Android live wallpaper tutorial

Anonymous said...

ok, cool... i just added a lot of different emo backgrounds to my blog

Anonymous said...

Hey your website is nice
you should watch at that crazy emo video clip:

Anonymous said...

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.

Sam said...

Awesome posting. Delighted that you distributed that.
Whenever anybody is attempting to down load wallpapers for mobile phone, these people find it challenging, as mostly individuals in India have substandard quality mobiles.
I am not necessarily usual of commenting however I noticed one excellent resource of transfering just about all your mobile wallpapers, mobile games and mobile animation direct to your cell phone.

Anonymous said...

I think you have a great page here… today was my first time coming here.. I just happened to find it doing a google search. anyway, good post.. I’ll be bookmarking this page for sure.

Anonymous said...

Sir, you've said that you played with the Surface View of Duck Hunt right? so does that mean you "imported" an application and "converted" it into Live Wallpaper?

If so, I would like to learn how to do it! You see, I manage to obtain an interactive Android App and I wanted it as a live wallpaper.

Please Help me, Thanks!!

GeekYouUp said...

The source for my game is here http://code.google.com/p/android-duckgame/ and my live wallpaper is here http://code.google.com/p/android-duckhunt-livewallpaper/ feel free to browse.

Anonymous said...

Very nice, I've been using your source code as a base and I have successfully added Accelerometer as well as onShake events.

I'm just wondering if you could help me (or everyone) to develop a simple "space shooter" live wallpaper.

And is there any way I could contact you!? please, I'm interested in this new live wallpaper concept. XD

Anonymous said...

Sir, can you make a Live Wallpaper object that shoots beams?

GeekYouUp said...

Hey. Live Wallpapers have been around for quite a while now, there should be plenty of examples on line. Good luck with the space shooter.

Android app developers said...

I like your blog appearance.This is one of the out knowledgeable post.We can learn some good tips related to Android from this post.