Skip to content

NinchatConfiguration

Pallab edited this page Apr 14, 2021 · 5 revisions

NinchatConfiguration

Using NinchatConfiguration, we can assign a custom/dynamic username, and other attribuets to the client session.

val ninchatConfiguration = NinchatConfiguration.Builder()
                .setUserName("A dynamic user name")
                .create()

val builder = NinchatSession.Builder(applicationContext, configurationKey)
builder.setConfiguration(ninchatConfiguration)
.....
.....
val ninchatSession = builder.create()

Add one time session bound user name

In order to pass a dynamic session bound custom user name in our SDK, we can call setUserName method with a custom name in our NinchatConfiguration builder object.

val builder = NinchatConfiguration.Builder()
builder.setUserName("A dynamic user name")
val ninchatConfiguration = builder.create()

Provide session bound custom chat background

We can override ninchat chat background using our own asset. The chat background must need to be a bitmap drawable image. In order to do that, we can simply pass our bitmap image asset id to NinchatConfiguration builder object.

val builder = NinchatConfiguration.Builder()
builder.setNinchatChatBackground(R.drawable.our_new_background_asset)
val ninchatConfiguration = builder.create()
  • Example of assets files
Screenshot 2021-04-14 at 13 25 37
Clone this wiki locally