@@ -432,76 +432,94 @@ CleverPush.getInstance(this).getDeviceToken(object : DeviceTokenListener {
432432
433433## Tags
434434
435- If you want to update tags from ** Dashboard to SDK** :
435+ ** Update tags from Dashboard → SDK** :
436436
437- If the ` Sync tags to client on subscription sync (App) ` option is enabled under ` General Settings → Advanced Settings ` in the dashboard , you can add or remove tags directly using the Subscription ID in the dashboard.
437+ If the ` Sync tags to client on subscription sync (App) ` option is enabled under ` Dashboard → General Settings → Advanced Settings` , you can add or remove tags directly from the dashboard using the Subscription ID.
438438
439- These changes will automatically sync with the SDK when ` syncSubscription ` occurs. By default, auto-sync happens every ** 3 days** . To update the tags immediately in the SDK, you can manually (force) call the ` subscribe() ` method.
439+ Any changes made in the dashboard will automatically sync with the SDK during the next subscription sync (` syncSubscription ` ).
440+
441+ By default, the SDK performs an automatic sync every ** 3 days** . If you want the updated tags to be reflected in the SDK immediately, you can manually trigger a sync by calling the ` subscribe() ` method.
442+
443+ ** Update tags from SDK → Dashboard** :
444+
445+ You can also manage subscription tags directly from the SDK. Changes made in the SDK will be synced to the dashboard automatically.
440446
441447<!-- DOCUSAURUS_CODE_TABS-->
442448
443449<!-- Java-->
444450
445451``` java
452+ // Retrieve all available tags
446453CleverPush . getInstance(this ). getAvailableTags(tags - > {
447454 // returns Set<ChannelTag>
448455});
449456
457+ // Get all subscribed tagIds
450458Set<String > subscribedTagIds = CleverPush . getInstance(this ). getSubscriptionTags();
451459
452- // add single tag
453- CleverPush . getInstance(this ). addSubscriptionTag(" TAG_ID" )
460+ // Add a single tag
461+ CleverPush . getInstance(this ). addSubscriptionTag(" TAG_ID" );
454462
455- // add single tag with success or failure callback
456- CleverPush . getInstance(this ). addSubscriptionTag(" " , new CompletionFailureListener () {
457- @Override
458- public void onComplete () {
459- System . out. println(" Subscription tag added successfully" );
460- }
463+ // Add a single tag with success/failure callback
464+ CleverPush . getInstance(this ). addSubscriptionTag(
465+ " TAG_ID" ,
466+ new CompletionFailureListener () {
467+ @Override
468+ public void onComplete () {
469+ System . out. println(" Subscription tag added successfully" );
470+ }
461471
462- @Override
463- public void onFailure (Exception exception ) {
464- System . out. println(" Error while adding subscription tag: " + exception. getLocalizedMessage());
472+ @Override
473+ public void onFailure (Exception exception ) {
474+ System . out. println(" Error while adding subscription tag: " + exception. getLocalizedMessage());
475+ }
465476 }
466- } );
477+ );
467478
468- // add multiple tags
479+ // Add multiple tags
469480CleverPush . getInstance(this ). addSubscriptionTags(new String [] {" TAG_ID_1" , " TAG_ID_2" });
470481
471- // remove single tag
482+ // Remove a single tag
472483CleverPush . getInstance(this ). removeSubscriptionTag(" TAG_ID" );
473484
474- CleverPush . getInstance(this ). removeSubscriptionTag(" TAG_ID" , new CompletionFailureListener () {
475- @Override
476- public void onComplete () {
477- System . out. println(" Subscription tag removed successfully" );
478- }
485+ // Remove a single tag with success/failure callback
486+ CleverPush . getInstance(this ). removeSubscriptionTag(
487+ " TAG_ID" ,
488+ new CompletionFailureListener () {
489+ @Override
490+ public void onComplete () {
491+ System . out. println(" Subscription tag removed successfully" );
492+ }
479493
480- @Override
481- public void onFailure (Exception exception ) {
482- System . out. println(" Error while removing subscription tag: " + exception. getLocalizedMessage());
483- }
484- });
494+ @Override
495+ public void onFailure (Exception exception ) {
496+ System . out. println(" Error while removing subscription tag: " + exception. getLocalizedMessage());
497+ }
498+ }
499+ );
485500
486- // remove multiple tags
501+ // Remove multiple tags
487502CleverPush . getInstance(this ). removeSubscriptionTags(new String [] {" TAG_ID_1" , " TAG_ID_2" });
488503
504+ // Check if subscription has a specific tag
489505boolean hasTag = CleverPush . getInstance(this ). hasSubscriptionTag(" TAG_ID" );
490506```
491507
492508<!-- Kotlin-->
493509
494510``` kotlin
511+ // Retrieve all available tags
495512CleverPush .getInstance(this ).getAvailableTags { tags ->
496513 // returns Set<ChannelTag>
497514}
498515
516+ // Get all subscribed tagIds
499517val subscribedTagIds = CleverPush .getInstance(this ).getSubscriptionTags()
500518
501- // add single tag
519+ // Add a single tag
502520CleverPush .getInstance(this ).addSubscriptionTag(" TAG_ID" )
503521
504- // add single tag with success or failure callback
522+ // Add a single tag with success/ failure callback
505523CleverPush .getInstance(this ).addSubscriptionTag(
506524 " TAG_ID" ,
507525 object : CompletionFailureListener {
@@ -515,13 +533,13 @@ CleverPush.getInstance(this).addSubscriptionTag(
515533 }
516534)
517535
518- // add multiple tags
536+ // Add multiple tags
519537CleverPush .getInstance(this ).addSubscriptionTags(arrayOf(" TAG_ID_1" , " TAG_ID_2" ))
520538
521- // remove single tag
539+ // Remove a single tag
522540CleverPush .getInstance(this ).removeSubscriptionTag(" TAG_ID" )
523541
524- // remove single tag with success or failure callback
542+ // Remove a single tag with success/ failure callback
525543CleverPush .getInstance(this ).removeSubscriptionTag(
526544 " TAG_ID" ,
527545 object : CompletionFailureListener {
@@ -535,9 +553,10 @@ CleverPush.getInstance(this).removeSubscriptionTag(
535553 }
536554)
537555
538- // remove multiple tags
556+ // Remove multiple tags
539557CleverPush .getInstance(this ).removeSubscriptionTags(arrayOf(" TAG_ID_1" , " TAG_ID_2" ))
540558
559+ // Check if subscription has a specific tag
541560val hasTag = CleverPush .getInstance(this ).hasSubscriptionTag(" TAG_ID" )
542561```
543562
@@ -670,25 +689,46 @@ Map<String, String> subscriptionAttributes = CleverPush.getInstance(this).getSub
670689// Get a single subscription attribute value
671690Object attributeValue = CleverPush . getInstance(this ). getSubscriptionAttribute(" user_id" );
672691
673- // You can set string values like this
692+ // Set a string value
674693CleverPush . getInstance(this ). setSubscriptionAttribute(" user_id" , " 1" );
675694
676695// Please provide dates in the following format: YYYY-MM-DD
677696CleverPush . getInstance(this ). setSubscriptionAttribute(" birthdate" , " YYYY-MM-DD" );
678697
679- // You can set array of string values like this
698+ // Set an array of strings
680699String [] array = {" 1" , " 2" , " 3" };
681700CleverPush . getInstance(this ). setSubscriptionAttribute(" user_id" , array);
682701
683- // You can set multiple key-value pairs like this
702+ // Set multiple key-value pairs
684703Map<String , String > attributes = new HashMap<> ();
685704attributes. put(" user_id" , " 1" );
686705attributes. put(" zip" , " 20097" );
687706CleverPush . getInstance(this ). setSubscriptionAttributes(attributes);
688707
689- // You can also push/pull values to special array attributes (e.g. "categories")
690- CleverPush . getInstance(this ). pushSubscriptionAttributeValue(" categories" , " category_1" );
691- CleverPush . getInstance(this ). pullSubscriptionAttributeValue(" categories" , " category_1" );
708+ // Remove a single attribute
709+ CleverPush . getInstance(this ). removeSubscriptionAttribute(" user_id" );
710+
711+ // Remove multiple attributes
712+ CleverPush . getInstance(this ). removeSubscriptionAttributes(new String [] {" user_id" , " zip" });
713+
714+ // Remove a single attribute with success/failure callback
715+ CleverPush . getInstance(this ). removeSubscriptionAttribute(
716+ " user_id" ,
717+ new CompletionFailureListener () {
718+ @Override
719+ public void onComplete () {
720+ System . out. println(" Attribute removed successfully" );
721+ }
722+
723+ @Override
724+ public void onFailure (Exception exception ) {
725+ System . out. println(
726+ " Error while removing subscription attribute: "
727+ + exception. getLocalizedMessage()
728+ );
729+ }
730+ }
731+ );
692732```
693733
694734< ! -- Kotlin -- >
@@ -705,24 +745,65 @@ val subscriptionAttributes = CleverPush.getInstance(this).getSubscriptionAttribu
705745// Get a single subscription attribute value
706746val attributeValue = CleverPush . getInstance(this ). getSubscriptionAttribute(" user_id" )
707747
708- // You can set string values like this
748+ // Set a string value
709749CleverPush . getInstance(this ). setSubscriptionAttribute(" user_id" , " 1" )
710750
711751// Please provide dates in the following format: YYYY-MM-DD
712752CleverPush . getInstance(this ). setSubscriptionAttribute(" birthdate" , " YYYY-MM-DD" )
713753
714- // You can set an array of string values like this
754+ // Set an array of strings
715755val array = arrayOf(" 1" , " 2" , " 3" )
716756CleverPush . getInstance(this ). setSubscriptionAttribute(" user_id" , array)
717757
718- // You can set multiple key-value pairs like this
758+ // Set multiple key-value pairs
719759val attributes = HashMap<String , String > ()
720760attributes[" user_id" ] = " 1"
721761attributes[" zip" ] = " 20097"
722762CleverPush . getInstance(this ). setSubscriptionAttributes(attributes)
723763
724- // You can also push/pull values to special array attributes (e.g. "categories")
764+ // Remove a single attribute
765+ CleverPush . getInstance(this ). removeSubscriptionAttribute(" user_id" )
766+
767+ // Remove multiple attributes
768+ CleverPush . getInstance(this ). removeSubscriptionAttributes(arrayOf(" user_id" , " zip" ))
769+
770+ // Remove a single attribute with success/failure callback
771+ CleverPush . getInstance(this ). removeSubscriptionAttribute(
772+ " user_id" ,
773+ object : CompletionFailureListener {
774+ override fun onComplete() {
775+ println(" Attribute removed successfully" )
776+ }
777+
778+ override fun onFailure(exception: Exception ) {
779+ println(
780+ " Error while removing subscription attribute: ${exception.localizedMessage}"
781+ )
782+ }
783+ }
784+ )
785+ ```
786+
787+ < ! -- END_DOCUSAURUS_CODE_TABS -- >
788+
789+ You can also push/ pull values to special array attributes (e. g. " categories" ).
790+
791+ < ! -- DOCUSAURUS_CODE_TABS -- >
792+
793+ < ! -- Java -- >
794+
795+ ```java
796+ CleverPush . getInstance(this ). pushSubscriptionAttributeValue(" categories" , " category_1" );
797+
798+ CleverPush . getInstance(this ). pullSubscriptionAttributeValue(" categories" , " category_1" );
799+ ```
800+
801+
802+ < ! -- Kotlin -- >
803+
804+ ```kotlin
725805CleverPush . getInstance(this ). pushSubscriptionAttributeValue(" categories" , " category_1" )
806+
726807CleverPush . getInstance(this ). pullSubscriptionAttributeValue(" categories" , " category_1" )
727808```
728809
@@ -1172,7 +1253,7 @@ groupId);
11721253< ! -- Kotlin -- >
11731254
11741255```kotlin
1175- CleverPush . getInstance(this ). getAppBannersByGroup { banners - >
1256+ CleverPush . getInstance(this ). getAppBannersByGroup( { banners: Collection< Banner > - >
11761257 for (banner in banners) {
11771258 println(banner. id)
11781259 }
0 commit comments