Batch-Android-SDK icon indicating copy to clipboard operation
Batch-Android-SDK copied to clipboard

Provide change listener for attributes

Open svenjacobs opened this issue 3 months ago • 2 comments

In our app, we frequently use Flows to propagate reactive data from the data layer to the UI layer. Many SDKs and libraries either natively support Flows or offer (change) listeners, which can be easily wrapped into Flows. This approach enables us to build reactive UIs: we can update an SDK value and immediately observe changes via a Flow or listener, eliminating the need to manually track changes or store temporary values.

Therefore, I kindly request that you provide change listeners for attributes, such as Batch.User.addAttributeChangeListener() and Batch.User.removeAttributeChangeListener(). These listeners would be triggered whenever an attribute is added, modified, or removed, allowing us to easily wrap this functionality with Flows.

Also see my issue #24, which I somewhat related to this.

svenjacobs avatar Sep 08 '25 14:09 svenjacobs

Hi again, I understand your need for this functionality.

As mentioned previously (in issue #24), the User module is part of our legacy Mobile Engagement Platform (MEP), which focuses on installation-specific data. We don't have plans to add new APIs or significantly update this module.

However, I will forward your feedback to our product team. It will be taken into consideration as we evaluate potential new features, such as adding fetching APIs to the Profile module.

Have a nice day.

arnaud-roland avatar Sep 09 '25 16:09 arnaud-roland

Hello Arnaud,

I didn't realize the difference between CEP and MEP until you explained it here 😃. Please understand this ticket as a feedback for CEP then. Apart from an API to fetch CEP attributes, an API for receiving (asynchronous) updates would be much appreciated, especially since CEP attributes can be changed from different sources. Since the Batch SDK is based on Kotlin as of version 3.0.0, maybe even a Flow-based API would be possible? 😉

svenjacobs avatar Sep 09 '25 16:09 svenjacobs