Skip to content

Commit

Permalink
feat: halt and stop without clear data (#82)
Browse files Browse the repository at this point in the history
Co-authored-by: Artūrs Kadiķis <[email protected]>
  • Loading branch information
arifBurakDemiray and ArtursKadikis authored Sep 28, 2023
1 parent 45224fc commit b654560
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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

0 comments on commit b654560

Please sign in to comment.