Skip to content

Commit 55b3ff6

Browse files
Added setKeepTargetingDataOnUnsubscribe method in Android doc
Added setKeepTargetingDataOnUnsubscribe method in Android doc
1 parent 4e1c929 commit 55b3ff6

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

docs/sdks/android/methods.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,40 @@ class MainActivity:Activity() {
400400

401401
<!--END_DOCUSAURUS_CODE_TABS-->
402402

403+
## Keep Trageting Data On Unsubscribe
404+
405+
(Available from version 1.23.5)
406+
407+
By default, the SDK automatically removes the following data from local storage when a user unsubscribes: Subscription ID, Topics, Tags, Attributes
408+
409+
The default value of `keepTargetingDataOnUnsubscribe` is false.
410+
411+
Set `keepTargetingDataOnUnsubscribe` to `true` to retain user targeting data locally even after the user unsubscribes.
412+
413+
This ensures that Topics, Tags, and Attributes are preserved locally, even when the user is no longer subscribed.
414+
415+
The subscriptionId is always removed and is not controlled by this flag.
416+
417+
On every `Unsubscribe()` call, the SDK removes: Subscription ID, Related sync/created fields
418+
419+
When `keepTargetingDataOnUnsubscribe` is enabled (true), the SDK keeps only: Topics, Topic version, Tags, Attributes
420+
421+
<!--DOCUSAURUS_CODE_TABS-->
422+
423+
<!--Java-->
424+
425+
```java
426+
CleverPush.getInstance(this).setKeepTargetingDataOnUnsubscribe(true);
427+
```
428+
429+
<!--Kotlin-->
430+
431+
```kotlin
432+
CleverPush.getInstance(this).setKeepTargetingDataOnUnsubscribe(true)
433+
```
434+
435+
<!--END_DOCUSAURUS_CODE_TABS-->
436+
403437
## Get Device Token
404438

405439
You can retrieve the current device token (used for push notifications) with the following method:
@@ -684,7 +718,7 @@ CleverPush.getInstance(this).getAvailableAttributes(attributes -> {
684718
});
685719

686720
// Get all subscription attributes
687-
Map<String, String> subscriptionAttributes = CleverPush.getInstance(this).getSubscriptionAttributes();
721+
Map<String, Object> subscriptionAttributes = CleverPush.getInstance(this).getSubscriptionAttributes();
688722

689723
// Get a single subscription attribute value
690724
Object attributeValue = CleverPush.getInstance(this).getSubscriptionAttribute("user_id");

0 commit comments

Comments
 (0)