Hi all.
I m trying to add a sticker pack on whatsapp via b4a.
this can be made with intent / file provider and manifest.
Here is the oficial android api
https://github.com/WhatsApp/stickers/blob/master/Android/README.md
on the final of page have a intent example and manifest
here is what whatsapp say to make
here is what i m trying to make on manifest
and later the is the intent part.
here is the whatsapp example
and here is what i m trying
and i get this error
the whatsapp is detecting i m trying to add a sticker pack, i think the error is on the image paths or something like this.....
the json file and the images are Attached
ps: only show me this pop up. nothing more, no logs
what i m making wrong based on the whatsapp example?
I m trying to add a sticker pack on whatsapp via b4a.
this can be made with intent / file provider and manifest.
Here is the oficial android api
https://github.com/WhatsApp/stickers/blob/master/Android/README.md
on the final of page have a intent example and manifest
here is what whatsapp say to make
The ContentProvider needs to have a read permission of com.whatsapp.sticker.READ in AndroidManifest.xml. It also needs to be exported and enabled. See below for an example:
B4X:
<provider
android:name=".StickerContentProvider"
android:authorities="${contentProviderAuthority}"
android:enabled="true"
android:exported="true"
android:readPermission="com.whatsapp.sticker.READ" />
here is what i m trying to make on manifest
B4X:
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.stickercontentprovider"
android:enabled="true"
android:exported="false"
android:readPermission="com.whatsapp.sticker.READ"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)
CreateResource(xml, provider_paths,
<files-path name="name" path="stickers"/>
)
and later the is the intent part.
here is the whatsapp example
B4X:
Intent intent = new Intent();
intent.setAction("com.whatsapp.intent.action.ENABLE_STICKER_PACK");
intent.putExtra("sticker_pack_id", identifier); //identifier is the pack's identifier in contents.json file
intent.putExtra("sticker_pack_authority", authority); //authority is the ContentProvider's authority. In the case of the sample app it is BuildConfig.CONTENT_PROVIDER_AUTHORITY.
intent.putExtra("sticker_pack_name", stickerPackName); //stickerPackName is the name of the sticker pack.
try {
startActivityForResult(intent, 200);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, R.string.error_adding_sticker_pack, Toast.LENGTH_LONG).show();
}
and here is what i m trying
B4X:
Sub Sticker_Whatsapp
Dim json As String = "contents.json"
Dim img1 As String = "1.webp"
Dim img2 As String = "2.webp"
Dim img3 As String = "3.webp"
Dim img4 As String = "4.webp"
Dim img5 As String = "5.webp"
Dim img6 As String = "6.webp"
Dim img7 As String = "7.webp"
Dim img8 As String = "8.webp"
Dim img9 As String = "9.webp"
Dim imgPrincipal As String = "tray_bolsonaro.png"
File.Copy(File.DirAssets, json, Starter.Provider.SharedFolder, json)
File.Copy(File.DirAssets, img1, Starter.Provider.SharedFolder, img1)
File.Copy(File.DirAssets, img2, Starter.Provider.SharedFolder, img2)
File.Copy(File.DirAssets, img3, Starter.Provider.SharedFolder, img3)
File.Copy(File.DirAssets, img4, Starter.Provider.SharedFolder, img4)
File.Copy(File.DirAssets, img5, Starter.Provider.SharedFolder, img5)
File.Copy(File.DirAssets, img6, Starter.Provider.SharedFolder, img6)
File.Copy(File.DirAssets, img7, Starter.Provider.SharedFolder, img7)
File.Copy(File.DirAssets, img8, Starter.Provider.SharedFolder, img8)
File.Copy(File.DirAssets, img9, Starter.Provider.SharedFolder, img9)
File.Copy(File.DirAssets, imgPrincipal, Starter.Provider.SharedFolder, imgPrincipal)
File.MakeDir(Starter.Provider.SharedFolder,"bolsonaro")
File.Copy(Starter.Provider.SharedFolder,json, Starter.Provider.SharedFolder&"/bolsonaro",json)
File.Copy(Starter.Provider.SharedFolder,img1, Starter.Provider.SharedFolder&"/bolsonaro",img1)
File.Copy(Starter.Provider.SharedFolder,img2, Starter.Provider.SharedFolder&"/bolsonaro",img2)
File.Copy(Starter.Provider.SharedFolder,img3, Starter.Provider.SharedFolder&"/bolsonaro",img3)
File.Copy(Starter.Provider.SharedFolder,img4, Starter.Provider.SharedFolder&"/bolsonaro",img4)
File.Copy(Starter.Provider.SharedFolder,img5, Starter.Provider.SharedFolder&"/bolsonaro",img5)
File.Copy(Starter.Provider.SharedFolder,img6, Starter.Provider.SharedFolder&"/bolsonaro",img6)
File.Copy(Starter.Provider.SharedFolder,img7, Starter.Provider.SharedFolder&"/bolsonaro",img7)
File.Copy(Starter.Provider.SharedFolder,img8, Starter.Provider.SharedFolder&"/bolsonaro",img8)
File.Copy(Starter.Provider.SharedFolder,img9, Starter.Provider.SharedFolder&"/bolsonaro",img9)
File.Copy(Starter.Provider.SharedFolder,imgPrincipal, Starter.Provider.SharedFolder&"/bolsonaro",imgPrincipal)
Dim in As Intent
in.Initialize("com.whatsapp.intent.action.ENABLE_STICKER_PACK", "")
in.SetComponent("com.whatsapp.intent.action.ENABLE_STICKER_PACK")
in.putExtra("sticker_pack_id", "bolsonaro")
in.putExtra("sticker_pack_authority", "b4a.example.stickercontentprovider")
in.putExtra("sticker_pack_name", "bolsonaro")
in.Flags = 1
Try
StartActivity(in)
Catch
Log(LastException)
End Try
End Sub
and i get this error
Error: There's a problem with this sticker pack and it can't be added to WhatsApp
the whatsapp is detecting i m trying to add a sticker pack, i think the error is on the image paths or something like this.....
the json file and the images are Attached
ps: only show me this pop up. nothing more, no logs
what i m making wrong based on the whatsapp example?