I using Xamarin to develop application.
How can I send picture via WhatsApp to number the I have in contact?
I using Xamarin to develop application.
How can I send picture via WhatsApp to number the I have in contact?
The easiest way would be to use Xamarin.Essentials share API
This will not only give you an option for whatsapp but many other supported applications as well
You might need different permissions based on OS so make sure to go through the docs throughtly
Add the using statement:
using Xamarin.Essentials;
Get a file from the File system and share it :
await Share.RequestAsync(new ShareFileRequest
{
Title = Title,
File = new ShareFile(file),
PresentationSourceBounds = DeviceInfo.Platform== DevicePlatform.iOS && DeviceInfo.Idiom == DeviceIdiom.Tablet
? new System.Drawing.Rectangle(0, 20, 0, 0)
: System.Drawing.Rectangle.Empty
});
Where File is the path of the file from your file system.
Goodluck let me know if you have any questions.
Make sure to check other amazing things available in Xamarin essentials.
UPDATE
Android:
Intent share = new Intent();
share.SetAction(Intent.ActionSend);
share.SetType("image/jpeg");
share.PutExtra(Intent.ExtraStream, yourImageUri);
share.SetPackage("com.whatsapp");
StartActivity(share);