I can not launch whatsapp

0

I can not get into the DependencyService from the main to launch 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);
    }
}
}

Call the interface from the main ():

DependencyService.Get<IWhatsApp>().OpenWhatsApp(whatsapp);
    
asked by edoman 11.05.2018 в 10:15
source

0 answers