Hi I'm having some trouble getting live wallpapers to work with android. I've gotten as far as getting a blank live wallpaper on android with the following:
AndroidManifest.xml
<activity android:name="org.godotengine.godot.Godot"
android:label="@string/godot_project_name_string"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize|smallestScreenSize"
android:resizeableActivity="false"
tools:ignore="UnusedAttribute">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="org.godotengine.godot.WallpaperTest"
android:enabled="true"
android:label="cube"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/wallpaper"></meta-data>
</service>
You can see here I've added org.godotengine.godot.WallpaperTest as a WallpaperService
and in org.godotengine.godot.WallpaperTest
package org.godotengine.godot;
import android.os.Handler;
import android.service.wallpaper.WallpaperService;
import android.view.SurfaceHolder;
public class WallpaperTest extends WallpaperService {
@Override
public Engine onCreateEngine() {
return new GDEngine();
}
public class GDEngine extends Engine {
private final Handler handler = new Handler();
private final Runnable runnable = new Runnable() {
@Override
public void run() {
drawFrame();
}
};
public GDEngine() {
handler.post(runnable);
}
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
super.onCreate(surfaceHolder);
setTouchEventsEnabled(true);
}
/*
@Override
public void onVisibilityChanged(boolean visible) {
if (visible) {
handler.post(runnable);
} else {
handler.removeCallbacks(runnable);
}
}*/
void drawFrame() {
System.out.println("Hello World. Does Godot go here?");
}
@Override
public void onSurfaceDestroyed(SurfaceHolder holder) {
super.onSurfaceDestroyed(holder);
handler.removeCallbacks(runnable);
}
}
}
This creates a blank wallpaper which you can start up and prints out "Hello World. Does Godot go here?" But that's as far as I've gotten. I'm having trouble linking the actual godot game with the Wallpaper service.
So the main question is how do you run the Godot game in the Wallpaper service?
I've been stuck on this for 2 days now so any help would be greatly appreciated.