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

feat: halt and stop without clear data #82

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* "removeFromCohort(key)"

* In Countly class, the old "init(directory,config)" method is deprecated, use "init(config)" instead via "instance()" call.
* Deprecated "Countly::stop(boolean)" call, use "Countly::halt" or "Countly::stop" instead via "instance()" call.
* Deprecated "Countly::event" call, deprecated builder pattern. Use "Countly::events" instead.
* Deprecated "Usage::event" call, deprecated builder pattern. Use "Countly::events" instead.
* Deprecated "Countly::stop(boolean)" call, use "Countly::halt" instead via "instance()" call.
Expand Down
14 changes: 11 additions & 3 deletions sdk-java/src/main/java/ly/count/sdk/java/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public static void init(final File sdkStorageRootDirectory, final Config config)
* Also clears all the data if called with {@code clearData = true}.
*
* @param clearData whether to clear all Countly data or not
* @deprecated use {@link #halt()} instead via instance() call
* @deprecated use {@link #halt()} instead via instance() call to clear data
* or {@link #stop()} to keep data
*/
public static void stop(boolean clearData) {
if (isInitialized()) {
Expand All @@ -150,6 +151,13 @@ public static void stop(boolean clearData) {
}
}

/**
* Stop Countly SDK. Stops all tasks.
*/
public void stop() {
stop(false);
}

/**
* Stop Countly SDK. Stops all tasks and releases resources.
*/
Expand Down Expand Up @@ -180,7 +188,7 @@ public static boolean isTracking(Config.Feature feature) {
*
* NOTE: {@link Session} instances can expire, for example when {@link Config.DID} changes.
* {@link Session} also holds application context.
* So either do not store {@link Session} instances in any static variables and use this method or {@link #getSession()} every time you need it,
* So either do not store {@link Session} instances in any static variables and use this method every time you need it,
* or check {@link Session#isActive()} before using it.
*
* @return active {@link Session} instance
Expand Down Expand Up @@ -218,7 +226,7 @@ public static ModuleBackendMode.BackendMode backendMode() {
}

/**
* Alternative to {@link #getSession()} & {@link #session()} method for accessing Countly SDK API.
* Alternative to {@link #session()} method for accessing Countly SDK API.
*
* @return {@link Usage} instance
*/
Expand Down