Construct games in react-native-webview not working on Android

0 favourites
  • 8 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi,

    I have a react native app in which I've added a webview (react-native-webview@11.18.1). In developer mode everything worked fine, until a few days ago when I published the app to google play and testflight. Everything works fine on iOS, but on android the game doesn't show in the webview in build mode. Only the background color fills the screen, but no game is loaded. No error messages as far as I can tell.

    Anyone knows why this is and if there's any way to solve it?

    The game is created with construct 3 and exported as html5.

    Thanks,

    Jacob

  • It's not clear exactly what you're doing, are you trying to load locally bundled resources in a custom webview? If so that's actually very tricky and requires a bunch of customisation to get it working. The existing mobile exporters handle all of that using Cordova to do the heavy lifting to make things work. I would recommend using that if you can. Otherwise the next easiest thing to do is publish the content of the webview to a public URL and point the webview at that.

  • I export the game as html5, extract it and host it on aws S3. Then I point my webview to the url of the index-file.

  • I've now noticed that the game is actually loading and "playable". But it's just a blank screen with the background-color.

    I can also clarify:

    The game works on iPhone in development and build version. It also works on android in development. It's only when creating a binary of the android app that the bug appears.

  • If you're loading from a web URL it should work.

    Make sure the app permits that URL though. Usually you have to specify a list of domains the app is allowed to access, which might only be enforced once you publish.

    If that isn't the problem, you'll need to set up USB debugging and check for console error messages.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • {"type":"info","log":"Registered service worker on https://path-to-game"} {"type":"info","log":"Made with Construct 3, the game and app creator :: https://www.construct.net"} {"type":"info","log":"[C3 runtime] Hosted in DOM, rendering with WebGL 2 [Mali-G72] (standard compositing)"}

    Nothing unusual about the logging. No error messages.

    I've read something about it being an issue with Android webviews and webgl. I.e. this issue from scirra https://bugs.chromium.org/p/chromium/issues/detail?id=934823

    Can't really understand if it's fixed or not.

    Could that be the issue, that the webview in react native for android simply can't render the construct 3 game canvas?

  • That issue was fixed in 2019 so I doubt it is that.

    I'm afraid it's hard to tell what might be wrong. I don't know anything about how react-native-webview works, so it might be best to ask on a general programming Q&A site like StackOverflow.

  • I agree, this doesn't seem to be connected to Construct, but rather the webview itself. Thanks anyway! :)

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