Question about Google Play cordova plugin

0 favourites
  • 6 posts
From the Asset Store
Google Analytics 4
$4.80 USD
20% off
Google Analytics 4 Plugin for Construct 3 enables metrics and analytics for your games easily.
  • Hi Nepeo

    How I can detect via javascript the state of player when he "On sign in failed", "On auto-sign in failed", "On signed out"? I doesn't found info about it in NPM readme.

    Thank you!

  • I think you should do it yourself using "callback".

  • I don't recommend interfacing with the cordova plugin directly. The API only supports one sign in state callback at a time, so if you override the callback then the plugin interface will stop receiving sign in events. So you basically have to replace everything the construct plugin does. Also worth noting that you will not be able to interface with cordova plugins when in worker mode, as they have to run in the window context.

    I would advise placing some functions that deal with the state changes in your script file, then calling those functions from the eventsheet when the condition is met.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ErenNepeo Thank you for answer!

    So you basically have to replace everything the construct plugin does.

    Yes, I want work with cordova plugin via js code, without construct plugin.

    Also worth noting that you will not be able to interface with cordova plugins when in worker mode, as they have to run in the window context.

    Does this mean that I should use - window.play.signin(); instead - play.signin();?

    But still, how do I catch the exit events and the failed entry?

  • In worker mode the runtime runs in a WebWorker. WebWorkers are considered a separate "thread" that runs along side the main "thread". Threads cannot directly access each other, which means they can run on independent CPU cores and hence not interfere with each other. The only way they can communicate is to send messages using the MessageChannel API.

    Cordova code has to run on the main thread. As you cannot read/write to the variables of other threads this means it cannot be accessed from a WebWorker. For Construct plugins that need to run on the main thread they register an additional script that the runtime knows to start on the main thread, which can send/receive messages from the main part of the plugin.

    I don't believe we have a mechanism for registering a user script to run on the main thread yet. So if you want to interface directly with Cordova plugins you will not be able to use worker mode.

    Incidentally "window" is not the global object in worker mode, and in fact doesn't exist...

    If you want to listen to changes in sign in state you need to use the "setCallback" method that Eren mentions.

  • Nepeo ok, thank you for answer!

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