I would like to send a text file through Xamarin to WhatsApp...
string path2 = Application.Context.FilesDir.Path;
var filePath = Path.Combine(path2, "test.txt");
System.IO.File.WriteAllText(filePath, "Hello World");
Intent sendIntent = new Intent();
sendIntent.SetAction(Intent.ActionSend);
sendIntent.PutExtra(Intent.ExtraText, "Lista de Precos");
Java.IO.File file = new Java.IO.File(filePath);
Android.Net.Uri uta;
uta = Android.Net.Uri.FromFile(file);
or
uta = Android.Net.Uri.Parse("file:///" + filePath);
sendIntent.PutExtra(Intent.ExtraStream, uta);
sendIntent.SetType("text/plain");
sendIntent.SetPackage("com.whatsapp");
StartActivity(sendIntent);
I would like send the text file to WhatsApp....
Thank you,
Rogério
Mail: rogerio.ricardo@uol.com.br