I am using image picker to pick animated webp images in react-native android and can add static stickers but it fails to add animated sticker pack. To avoid file type issues I have used sample stickers from WhatsApp's sample animated sticker assets. (png tray icon sized 96x96 under 50kb and 3 animated webp files)
I am using react-native-whatsapp-sticker and modified it according to a repo react-native-dynamic-whatsapp-sticker. Those modules have not get updated since 2-3 years so the repo does not contains code for animated stickers. So I compered my module with WhatsApp sample app and made changes accordingly.There is no errors building the apk and stickers get added if I set animated sticker pack to false. But setting "animated_sticker_pack"=true and then adding sticker pack, WhatsApp show error as "there is problem with this pack...".
below is the code and links for modules file. I have been trying hard to solve it but could not get success. Thanks in advance.
Code:
let pack = {
"identifier": 'id1',
"name": 'name1',
"publisher": 'pub',
"tray_image_file": tray,
"publisher_email": Meta['EMAIL'],
"publisher_website": Meta['SITE'],
"privacy_policy_website": Meta['POLICY'],
"license_agreement_website": Meta['LICENSE'],
"image_data_version":"1",
"avoid_cache":true,
"animated_sticker_pack":true, // if false then works fine for static sticker
"stickers": stickers // array of {image_file:image.uri, emojis:['', ''],}
}
const send = (pack) => {
return RNWhatsAppStickers.prepare(JSON.stringify(pack))
.then(str => JSON.parse(str.slice('1')) ) // {"animated_sticker_pack": 1, "identifier": "id1", "isWhitelisted": 0, "name": "name1", "publisher": "pub"}
.then(res => RNWhatsAppStickers.send(res.identifier,res.name) )
}
all those 5 java files responsible for sending sticker to WhatsApp. https://github.com/CrackerKSR/temporary