How to make my application run in background?


#1

I found this for unity http://docs.unity3d.com/ScriptReference/Application-runInBackground.html,
but I didn’t manage to find anything similar for playcanvas. Is there any (simple or just any) way to make my game made by playcanvas run in background?

thank you


#2

Hey @goldy,

PlayCanvas is just a HTML5 Engine, which is ran in a WebView on mobiles(assuming we’re talking mobile here). I don’t know much about background activity, but from my limited knowledge, background activity can’t be tied to UI, and as far as I know, WebView is always using UI.

I suggest you try to look up on Google for PhoneGap or other HTML5 compilers for iOS/Android, maybe there are some plugins that could help.


#3

Depends what you need to do. But it is generally not a good idea to do, as you will drain users battery quickly that way, without their concern, as loads of users not bother clearing taskbar on phones.

There are Service Workers, they allow some level of off-line js running, including triggered by notifications APIs, you need to check availability of those APIs across browsers first.