Sticker Message Module

There are two ways to add extra sticker packs. Using a plist configuration file or programmatically. The following image formats are supported: png,gif.

Plist

Create a new plist file with the following format:

[
{
icon: "pack-icon.png",
stickers: [
"sticker1.png",
"sticker2.png",
...
]
}, ...
]

Then tell the app to use your plist file:

Java
Swift
Java
ChatSDK.builder()
...
.build()
...
.addModule(StickerMessageModule.builder()
.setLoadStickersFromPlist(R.raw.stickers_plist)
.build())
...
Swift
StickerMessageModule.shared().setCustomStickers(plist: "plist_name", bundle: Bundle.main)

The bundle should be where both plist file and the stickers are located.

Programatically

Stickers can also be added programmatically.

Java
Swift
Java
StickerPack pack = new StickerPack(R.drawable.icon);
pack.addSticker(R.drawable.sticker_1, "sticker_1.png");
pack.addSticker(R.drawable.sticker_2, "sticker_2.png");
StickerMessageModule module = StickerMessageModule.builder()
.setLoadStickersFromPlist(false)
.build();
module.addPack(pack);
ChatSDK.builder()
...
.build()
...
.addModule(module)
...
Swift
let sticker1 = Sticker(image: "image1.gif", sound: "sound.caf")
let sticker2 = Sticker(image: "image2.gif", sound: "sound.caf")
let pack = StickerPack(icon: "pack-icon.png", stickers: [
sticker1,
sticker2,
])
StickerMessageModule.shared().addPack(pack)
StickerMessageModule.shared().loadStickersFromPlist = false