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:
1
[
2
{
3
icon: "pack-icon.png",
4
stickers: [
5
"sticker1.png",
6
"sticker2.png",
7
...
8
]
9
}, ...
10
]
Copied!
Then tell the app to use your plist file:
Java
Swift
1
ChatSDK.builder()
2
...
3
.build()
4
...
5
.addModule(StickerMessageModule.builder()
6
.setLoadStickersFromPlist(R.raw.stickers_plist)
7
.build())
8
...
Copied!
1
StickerMessageModule.shared().setCustomStickers(plist: "plist_name", bundle: Bundle.main)
Copied!
The bundle should be where both plist file and the stickers are located.

Programatically

Stickers can also be added programmatically.
Java
Swift
1
StickerPack pack = new StickerPack(R.drawable.icon);
2
pack.addSticker(R.drawable.sticker_1, "sticker_1.png");
3
pack.addSticker(R.drawable.sticker_2, "sticker_2.png");
4
​
5
StickerMessageModule module = StickerMessageModule.builder()
6
.setLoadStickersFromPlist(false)
7
.build();
8
​
9
module.addPack(pack);
10
​
11
ChatSDK.builder()
12
...
13
.build()
14
...
15
.addModule(module)
16
...
Copied!
1
let sticker1 = Sticker(image: "image1.gif", sound: "sound.caf")
2
let sticker2 = Sticker(image: "image2.gif", sound: "sound.caf")
3
​
4
let pack = StickerPack(icon: "pack-icon.png", stickers: [
5
sticker1,
6
sticker2,
7
])
8
​
9
StickerMessageModule.shared().addPack(pack)
10
StickerMessageModule.shared().loadStickersFromPlist = false
Copied!
​
Last modified 10mo ago
Copy link