Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events which sent soon after initialize() can be lost because of false "SDK is disabled" decision #398

Open
Scmorrka opened this issue Jan 4, 2024 · 0 comments

Comments

@Scmorrka
Copy link

Scmorrka commented Jan 4, 2024

In my game I've implemented recommended sequence:

// Configure build version
configureBuild("some build");
// Initialize
initialize(key1, key2);
// Add Design event
...
addDesignEvent("General:App_Started");
...
addDesignEvent("General:BannerEnabled");
...
addDesignEvent("General:FUE1_shown");

For ~10-15% of players I see one or two or more first events are lost. For example, log shows "Could not add design event :SDK is disabled" for two first events and then other events are sent with no problem.

Checking SDK code I see following:

  • GAState.instance.initAuthorized by default is "false"
  • initialize() calls internalInitialize() which calls newSession() which do this: GAHTTPApi.instance.requestInit(GAState.instance.configsHash, GameAnalytics.startNewSessionCallback); and immediately exit from function
  • GAState.instance.initAuthorized is set to true only in callback
  • so, if request is slow, then one or two first events after method "initialize" are not registered because "SDK is disabled"

In my game I tried to add delay like 1.5 seconds but still see lost events anyway. Even 3 seconds isn't a guarantee.

I see no possibility to track/wait for internal request finish and only then start sending design events. Probably I can use isSdkReady method but I think creating my own local queue of event to wait until isSdkReady is true is wrong because SDK declared as doing the same internally. Probably GAState.instance.initAuthorized should be three state flag "not_yet_checked", "authorized" and "not_authorized" to allow adding events in queue after initialize even with slow or no internet connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant