Skip to content

Usage: LDClient::close() on application termination unclear #109

@nwellis

Description

@nwellis

Describe the bug
I'm confused on how to close the LD client from the docs:

Lastly, when your application is about to terminate, shut down ldClient. This ensures that the client releases any resources it is using, and that any pending analytics events are delivered to LaunchDarkly. If your application quits without this shutdown step, you may not see your requests and users on the dashboard, because they are derived from analytics events. This is something you only need to do once.
https://docs.launchdarkly.com/sdk/client-side/android#getting-started

I think its atypical to listen for application termination as it's not something an application can listen to? Looking at an Application's onTerminate() callback the doc states:

    /**
     * This method is for use in emulated process environments.  It will
     * never be called on a production Android device, where processes are
     * removed by simply killing them; no user code (including this callback)
     * is executed when doing so.
     */
    @CallSuper
    public void onTerminate() {
    }

The ProcessLifecycleOwner.java states something similar. Am I missing something? Is there an example I can reference to help me out in this regard? Thank you for your time!

SDK version
2.13.0

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