Android Question Whatsapp Intent

Chandrashekhar

Member
Licensed User
Longtime User
Please Help.

Following code doesn't work with whatsapp.

I can pickup contact from whatsapp but after that is says "sharing failed. please try again"




Code:
B4X:
Sub button1_click
Dim u As Uri
u.Parse("file://" & File.Combine(File.DirDefaultExternal,"writeon.png"))
Dim i As Intent
i.Initialize(i.ACTION_SEND,"")
i.SetType("image/png")
i.SetComponent("com.whatsapp/.ContactPicker")
i.PutExtra("android.intent.extra.STREAM",u)
StartActivity(i)
End Sub
It works for plain tax like this

B4X:
Sub button1_click
Dim i AsIntent
i.Initialize(i.ACTION_SEND,"")
i.SetType("text/plain")
i.SetComponent("com.whatsapp/.ContactPicker")
i.PutExtra("android.intent.extra.TEXT","HELLO")
StartActivity(i)
End Sub

Please help..... Thanks in advance
 

Chandrashekhar

Member
Licensed User
Longtime User
The code above works perfectly for sending images to whatsapp as well. It was my mistake for writing file name.

Thanks a LOT EREL.
 
Last edited:
Upvote 0

bionicle

New Member
Licensed User
Longtime User
hi
did anybody find a solution to send a text message directly to a specific whatsapp contact, without using the contact picker.??
Thanks for help
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…