9

I am looking for a sample code on Android Screen Saver. I tried google but hard to find any useful result. Does anyone have any good samples on that?

What I saw is Custom Android Screensaver (or sleep screen)

If you mean creating your own lock screen, there is no provision for this in the Android SDK

But I do not understand on this, as I saw there are so many screen saver application example in Android Market.

Community
  • 1
  • 1
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875

1 Answers1

8

Are you really talking about a screensaver? Or a custom lock screen?

The custom lock screens for OEM skins like HTC Sense and Motoblur are done by modifying the Android platform itself.

There are some custom lock screens available in the market as well. To achieve this, you need to add the following intent filter to the AndroidManifest.xml file for the Activity you want to use as a lock screen:

<intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.HOME" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Doing it this way is a hack because a dialog box will pop up asking the user which one he wants to use (yours or the default). Lock 2.0 is an example of a custom lock screen that works this way.

dbyrne
  • 59,111
  • 13
  • 86
  • 103
  • Moreover, if the user accidentally makes the lock screen the default home screen via the chooser checkbox, they are probably screwed, short of perhaps a safe-mode reboot or hardware-initiated factory reset. That is why these so-called "lock screen" apps are generally not a good idea. – CommonsWare Mar 10 '11 at 15:21
  • Agreed. Maybe this is an issue that should be addressed in a future version of Android. – dbyrne Mar 10 '11 at 15:24
  • The custom lock screens for OEM skins like HTC Sense and Motoblur are done by modifying the Android platform itself. Sorry, I don't really understand the above. Can you further explain? Does it means it is not possible for android developer to develop screen saver app? But how about this list of app tha claim themselves as screensaver app? http://www.androidzoom.com/android_applications/screensavers%20for – Shuwn Yuan Tee Mar 11 '11 at 02:08
  • 1
    I currently building a normal android app under emulator environment (without having real phone for testing). But I would like to convert my app (just some animation will be trigger based on user input touch event) to screen saver. Is that possible? Like instead of using Activity, change to use other Application Components (maybe Services - which run in background)? Or just change some attribute of the Activity in AndroidManifest.xml? – Shuwn Yuan Tee Mar 11 '11 at 02:08