-
Notifications
You must be signed in to change notification settings - Fork 708
Anchor 07 Creating a Day Dream
contriteobserver edited this page Jul 16, 2017
·
1 revision
Day dreams are actually quite simple. The Rajawali Day Dream implementation only requires passing an implementation and then setting up the boilerplate Android xml.
The XML for Day Dreams is extremely similar to the Live Wallpaper XML. Below is the implementation from my sample application.
raw/daydream.xml
<dream xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.testing.rajawali.DayDream" />
<service
android:name="com.testing.rajawali.DayDream"
android:exported="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.service.dreams.DreamService" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.service.dream" android:resource="@xml/daydream"/>
</service>
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public class DayDream extends RajawaliDaydream {
@Override
protected RajawaliRenderer createRenderer() {
return new MyRenderer(this);
}
}
Day Dreams can only be used on Android 4.2 and greater devices. To set a day dream, access Settings > Display > Daydream. From here you can configure when day dreams should appear or force one to show up immediately via the "START NOW" option.
You can find the complete implementation example that this wiki was created with here: Rajawali Wallpaper and Activity Example