Exporting HTML5 vs Cordova

  • I'm working on a cordova app that's going to house multiple games, some made with Construct, others from scratch. So far, I've built the cordova app from scratch and I've just been exporting my Construct games as HTML5 (in embed mode). They seem to be working fine within the cordova shell I've built.

    Is there any advantage to exporting as cordova if I'm not going to be using the config.xml Construct generates?

    Or to put it another way, does Construct export cordova differently than HTML5 other than just the inclusion of config.xml?

    Thanks!

  • Okay, so in case anyone ever happens to have this same odd question, here's what I learned. There do appear to be some differences inside c2runtime.js that check for cordova specifically. Most of them seem relatively minor.

    But the biggest difference is that within index.html, there are a couple listeners that will suspend the game when the app moves to the background. That turns out to be essential because if you don't suspend the game when the user switches apps, iOS will most likely kill and reboot the app, losing the user's progress.

    So if you ever end up in a situation where you're building a cordova app where you load in a construct game (rather than just exporting a single construct game as a cordova app), make sure you listen for cordova's pause and play events, then call cr_setSuspended accordingly.

    Aaaaand this will probably help no one. But I was pleased with myself that I figured it out.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Someone might find this useful in the future. Thanks for sharing.

  • Aaaaand this will probably help no one. But I was pleased with myself that I figured it out.

    You're the man! Thanks for sharing

  • dogjune

    Interesting. Thank you for sharing. Does this mean that if I create an app via C2 and export it as HTML5, it won't have those listeners unless I export them as CORDOVA?

    I find that when I export my project as CORDOVA the scaling is off when launching it using Cocoon, but not when it is exported as HTML5. Am I missing something?

    EDIT: Nvm. I think the scaling was due to WebGL turned off. Enabling it seems to do the trick.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)