Creating Interactive Screen Saver with Daydream

DayDreams are interactive screensavers launched when a charging device is idle, or docked in a desk dock. Dreams provide another modality for apps to express themselves, tailored for an exhibition/lean-back experience. So it’s found here and an official example can be found here. DayDream feature was introduced in  Android 4.2,brings this kind of laid-back, whimsical experience to Android phones and tablets that would otherwise be sleeping.However if you haven’t checked it out, you can turn it on in the Settings app, in Display > Daydream touch When to Daydream to enable the feature when charging or docking or both in some cases.

An attract mode for apps

Apps that support Daydream can also take advantage of the full Android UI toolkit in this mode, which means it’s easy to take existing components of your app — including layouts, animations, 3D, and custom views—and remix them for a more ambient presentation.

And since you can use touchscreen input in this mode as well, you can provide a richly interactive experience if you choose.




.Daydream also provides an opportunity for your app to show off a little bit. However you can choose to hide some of your app’s complexity in favor of one or more visually compelling experiences that can entertain from across a room, possibly drawing the user into your full app, like a video game’s attract mode.

The architecture of a Daydream

In fact each Daydream implementation is a subclass of android.service.dreams.DreamService. When you extend DreamService, you’ll have access to a simple Activity-like life-cycle API.

As a matter of fact to be available to the system, your DreamService should be declared in the manifest as follows:

Daydream is only available on devices running version 4.2 of Android , which is API Level 17 and above.When targeting api level 21 and above, you must declare the service in your manifest file with the BIND_DREAM_SERVICE permission.




In fact additional information is specified with the <meta-data> element. So additional information for the dream is defined using the <dream> element in a separate XML file. As a result it allows you to point to an XML resource that specifies a settings Activity specific to your Daydream. Currently, the only addtional information you can provide is for a settings activity that allows the user to configure the dream behavior  For example:

res/xml/dream_info.xml

This makes a Settings button available alongside your dream’s listing in the system settings, which when pressed opens the specified activity.

In order to specify your dream layout, call setContentView(View), typically during the onAttachedToWindow() callback For example:

DayDream.java

Consequently layout for dreaming can be whatever we like,  can include animation interactive ui etc.However, be aware that if your screen saver is using too much of the available processing resources, the Android system will stop it from running to allow the device to charge properly.

 

Even so “Creating Interactive Screen Saver with Daydream” is explained above you can still download it from here, You can modify the code us u like. In like manner feel free to comment your doubt’s below. Does our tutorials help you then help as spread the word, like and share.

 

One thought on “Creating Interactive Screen Saver with Daydream

Leave a Reply

%d bloggers like this: