Libgdx now supports Daydream mode on Android

Thanks to contributor talklittle, you can now write Daydream apps with libgdx. Daydream apps are a new feature in Android 4.2. When idle or docked, a 4.2 device can display information like a photo album and so on.

Daydreams are pretty easy to create. Here’s the one from our test collection:

Extend from AndroidDaydream, then override the onAttachedToWindow method where you create your ApplicationListener and register it via the initialize method. Note that you have to call the super onAttachedToWindow method, just as you have to call onCreate() for a normal AndroidApplication.

You can have a separate standard Android activity that lets a user define specific settings. If you do that you also need to add an xml file in your Android project’s res/xml/ folder. Here’s an example daydream.xml:

In addition to the AndroidDaydream and the settings activity, you have to register a specific service so your daydream is available to the user. Here’s an example snippet from the AndroidManifest.xml file:

And that’s it.

3 thoughts on “Libgdx now supports Daydream mode on Android

  1. It’s worth pointing out that you will also need
    as part of your service definition

Leave a Reply

Your email address will not be published.