Skip to content

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

Open
@Scmorrka

Description

@Scmorrka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions