Topics
Our SDK allows you to classify users into different customizable groups. This is very useful for:
- Implement a preferences screen so that the user can choose the topics for which they want to receive notifications.
- Label according to the navigation or actions that the user performs.
- Segment communications according to whether the user has identified or is anonymous.
- Segment based on language, culture, customer category, or based on any other criteria you need.
Remember that you must first define the groups you want to work with in the indigitall console (Tools> Topics).
- List groups
Use the topicsList method to get the list of groups that are configured in your indigitall project. The callback of this method receives as a parameter an array of Topics, which contains the information of all the available groups, as well as a flag that indicates whether the user is included in any of them.
InAppIndigitall.topicsList(context, new BaseCallback() {
@Override
public void onSuccess(JSONObject json) {
//get json
}
@Override
public void onFail(ErrorModel errorModel) {
//print error
}
});
- Manage subscription
To manage the device subscription to one or more groups, there are two methods: topicsSubscribe and topicsUnsubscribe.
Optionally, both receive a TopicsCallback object as the third parameter, which will return the list of all Topic in the project.
//topics is typeof string[]
InAppIndigitall.topicsSubscribe(context, topics, new InAppTopicCallback() {
@Override
public void onSuccess(@NonNull String topicCodes) {
///get codes
}
@Override
public void onError(@NonNull InAppErrorModel error) {
//print error
}
});
//topics is typeof string[]
InAppIndigitall.topicsUnsubscribe(context, topics, new InAppTopicCallback() {
@Override
public void onSuccess(@NonNull String topicCodes) {
///get codes
}
@Override
public void onError(@NonNull InAppErrorModel error) {
//print error
}
});