Embedding Defold games in mobile apps

Hi everyone,

I am looking for a way to create a library out of a Defold game that can be embedded inside Android/iOS apps. From the documentation I only found how to build standalone apps (e.g., apks/aabs on Android). For example, on Android my guess was that in the end there is a custom activity that is started and in theory it should be possible to package the game such that in another app I can start that activity somewhere from within the app, e.g., on the click of a button.

Any help would be greatly appreciated.

1 Like

Correct,. If you bundle for Android you’ll see that the manifest refers to DefoldActivity, and there’s some Android resources, engine binaries and custom game archive. You might be able to package this as an .aar file and include it in another project as a Gradle dependency.

But isn’t it better if you bundle your Defold game as HTML5 and launch it in a WebView? It works on both iOS and Android.

We are planning on using some native extensions which would not work via the WebView (e.g., camera and sensor access).

Ok, so we’ll experiment a bit with the activity and see whether we can make it work. Any additional pointers (also for iOS) would be very welcome.

1 Like

This is an interesting topic. Webview seems like a good option, but wondering how it would perform. Would love to see what you find.

1 Like

On modern phones (~5 years old), performance for most well optimized Defold games should be fine in a webview.

1 Like

still a webview cannot access native apis, so regrettably that is not an option for us.

Is it possible to proxy it through the native app though?