Advanced Settings

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
  }
});

List groups from console

This method can be customized with the following options:

  • inAppConfig (InAppConfiguration): Configuration object.
    • appKey (string, required): Application key.
    • urlInAppApi (string, optional): Custom InApp API URL. Only required if you work with a custom cloud environment.
  • limit: Defines the number of topics that will be returned on each page. The minimum allowed value is 20.

When calling the method, you will receive the topics in a paginated format. This means you can check the current page, view the available topics, and continue loading additional pages until there are no more results.

In case of error, the method provides an error callback so you can handle the issue appropriately.

val inAppConfig = InAppConfiguration.Builder(appKey)
    .setUrlInAppApi(inAppApi) // Optional: only if you use a custom cloud
    .build()

Indigitall.inAppTopicsListFromConsole(
    context,
    inAppConfig,
    20, // Minimum value is 20
    object : InAppTopicListFromConsoleCallback(context) {

        override fun onSuccess(inAppPageTopic: InAppPageTopic) {
            // Access current page topics
            println("Topics page ${inAppPageTopic.currentPage}: ${inAppPageTopic.topics}")

            // Check if more pages are available
            if (inAppPageTopic.hasNextPage()) {
                inAppPageTopic.loadNextPage() // Loads the next page
            } else {
                println("No more InApp topics available")
            }
        }

        override fun onError(error: InAppErrorModel) {
            // Handle error
            println("Error retrieving topics: $error")
        }
    }
)

When the request is successful, the onSuccess callback provides an InAppPageTopic object.

  • Fields
    • topics (ArrayList?): List of topics included in the current page.
    • currentPage (Int): Current page index. Starts at 0.
    • total (Int): Total number of topics available across all pages.
    • pageSize (Int): Maximum number of topics per page, obtained from configuration.
    • totalPages (Double): Total number of pages available, calculated as total / pageSize.
  • Methods
    • hasNextPage(): Boolean
      Returns true if there are additional pages of topics to load.
    • loadNextPage()
      Loads the next page of topics. If there are no more pages available, it will call onError with the code INAPP_TOPIC_LIST_NO_MORE_PAGES.


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[] or InAppTopic[]
InAppIndigitall.topicsSubscribe(context, topics, new InAppTopicCallback() {
  @Override
  public void onSuccess(@NonNull String topicCodes) {
		///get codes
  }
  
  @Override
  public void onSuccess(@NonNull ArrayList<InAppTopic> topics) {
		///get codes
  }  

  @Override
  public void onError(@NonNull InAppErrorModel error) {
		//print error
  }
});

//topics is typeof String[] or InAppTopic[]
InAppIndigitall.topicsUnsubscribe(context, topics, new InAppTopicCallback() {
  @Override
  public void onSuccess(@NonNull String topicCodes) {
		///get codes
  }
  
  @Override
  public void onSuccess(@NonNull ArrayList<InAppTopic> topics) {
		///get codes
  }  

  @Override
  public void onError(@NonNull InAppErrorModel error) {
		//print error
  }
});

Profile

You can set the profile variable when displaying an InApp. This allows you to add an additional type of filter — for example, if you want to control the display of the InApp for different users within the same campaign, without needing to create multiple ones with the same schema code.

InAppConfiguration.Builder inAppConfig = new InAppConfiguration.Builder("YOUR_APP_KEY");
inAppConfig.setUrlInAppApi("https://device-api.indigitall.com/v2");
inAppConfig.setProfile("YOUR_PROFILE");
inAppConfig.build();

Custom Time Slide for Carousel

You can set the custom time slide variable when displaying an InApp with a carousel.
This allows you to define the interval (in milliseconds) that each image will be shown before automatically changing to the next one.

InAppConfiguration.Builder inAppConfig = new InAppConfiguration.Builder("YOUR_APP_KEY");
inAppConfig.setUrlInAppApi("https://device-api.indigitall.com/v2");
inAppConfig.setCustomTimeSlideForCarousel(3000); // 3 seconds per image
inAppConfig.build();

Default value: if not set, the carousel will use 10000ms.

  • Custom value: you can pass any positive integer (milliseconds). For example:

1000 → 1 second

3000 → 3 seconds

5000 → 5 seconds