No consigo que entre en el DependencyService desde el main para lanzar Whatsapp
Interface:
public interface IWhatsApp
{
void OpenWhatsApp(StringBuilder whatsapp);
}
Android:
[assembly: Xamarin.Forms.Dependency(typeof(IWhatsApp))]
namespace Proyecto
{
public class WhatsAppAndroid : IWhatsApp
{
public void OpenWhatsApp(StringBuilder whatsapp)
{
Intent was = new Intent();
was.SetAction(Intent.ActionSend);
//was.PutExtra(Intent.ExtraText, whatsapp.ToString());
was.SetType("text/plain");
was.SetPackage("com.whatsapp");
Forms.Context.StartActivity(was);
}
}
}
Llamada al interface desde el main():
DependencyService.Get<IWhatsApp>().OpenWhatsApp(whatsapp);