Creation of android application with babylon

I am new to the game development. I am trying to develop a VR application for android and I have got the application working in playground. I wanted to know if anyone knew how to export it and test it on my android using an apk file. I am not sure how game engines work as I know with unity you can select android functionality when exporting the application. I am trying to use android studio but I am not sure how to use the javascript code to create my apk.

2 Likes

Why not creating a PWA instead ? Use Progressive Web Apps - Android - Google Chrome Help

Or you would need to create a webview and embed your code in.

Thanks for replying so quickly. Would PWA work across all platforms as I need it to run on VR devices as well as Iphone android and as a website. Please advise. I think it needs to be a webview with embedded code for all of that functionality.

PWA would work great on Android devices but you mentioned apk earlier and this would anyway not run on IOS. IOS does not support WebXR at the moment so the only cross plat you could potentially leverage would be Babylon React Native: Babylon React Native

Currently I am working on android at the moment and for testing we need an apk I believe to run applications on an android device. In terms of iOS could we not just build a plugin that would be able to run the application?

If you really need an .apk then you should consider the webview solution that @sebavan allready pointed out!

You could use e.g. MAUI or Electron for this.

I am still not sure of the requirements I am not sure what you mean by “just a plugin”

What about performance when you put 3D babylon game in a webview? It will not work as well as a native app, right?

That is correct! But consider that babylon will never have full native capabilities, because it’s a webframework that runs in a browser. A webview component is an implementation of a browser engine, so there should be no drawbacks or noticeable difference (in theory :nerd_face:).

If you need native perfomance then you may check: Babylon Native: cross-platform native apps with the power of Babylon.js

1 Like

Thanks for all the help @wulf11 and @sebavan. I think I would try go forward with PWA or electron for now and test. I just had a couple more questions, for the android implementation, do I just download the babylon native from github and place the folder in the folder of the applications? as well as how do I reference that I am using babylonjs as my game engine in my js file?
I really appreciate the help as I am extremely new to game development and android devices and have no idea how to move forward.

cc @bghgary for the native part but it will be a pretty complex one if you are brand new in Dev.

I would recommend the PWA road for now.

1 Like

Babylon Native for mobile (especially iOS) will likely run slower than WebView and browsers due to lacking JIT. See here: BabylonNative/WhenToUseBabylonNative.md at master · BabylonJS/BabylonNative (github.com)

2 Likes