This is the easiest way to add App Inbox functionality to your mobile app. In this setup app will be using the default notification center activity provided by the SDK for displaying inbox messages and managing them. You can also customize the appearance of the notification center activity to match your app theme.

Displaying App Inbox Contents

You can lauch notification center activity to display App Inbox messages. Following code snippet can be used whenever you want to show inbox messages to the app user.

CastledNotifications.showAppInbox(context, styleConfig)

Acitivity appearance can be customized using styleConfig. More details below.

Customising App Inbox Display

  // Customise the App Inbox styling using the below mentioned parameters
  val styleConfig = CastledInboxDisplayConfig()
  styleConfig.emptyMessageViewText = "There are no inbox items."
  styleConfig.emptyMessageViewTextColor = "#000000"
  styleConfig.inboxViewBackgroundColor = "#ffffff"
  styleConfig.navigationBarBackgroundColor = "#0000ff"
  styleConfig.navigationBarTitleColor = "#ffffff"
  styleConfig.navigationBarTitle = "Castled Inbox"
  styleConfig.hideNavigationBar = true
  styleConfig.hideBackButton = false                     // Set to true if back button needs to be hidden
  styleConfig.backButtonResourceId = myCustomButtonResId // Required only if you want to override default back button

  // Categories tab styling
  styleConfig.showCategoriesTab = true
  styleConfig.tabBarDefaultBackgroundColor ="#00203F"
  styleConfig.tabBarSelectedBackgroundColor = "#EEA47F"
  styleConfig.tabBarDefaultTextColor = "#ADEFD1"
  styleConfig.tabBarSelectedTextColor = "#00539C"
  styleConfig.tabBarIndicatorBackgroundColor = "#FEE715"

  CastledNotifications.showAppInbox(context, styleConfig)

Retrieving Unread Message Count

The SDK offers method to obtain the count of unread messages, suitable for display purposes. One use case is to show the unread message count as a badge on notification bell icon to prompt user to check on pending inbox items.

  CastledNotifications.getInboxUnreadCount {
    // do something with unread count $it