0

I'm programming in Xamarin.Forms (PCL), and I have seen many post but none one works for me. I'm using the plugin PhoneCall.Forms.Plugin I made a method to call with a button that contains the next code

try
{
    var PhoneCallTask = CrossMessaging.Current.PhoneDialer;
    if (PhoneCallTask.CanMakePhoneCall)
    {
        PhoneCallTask.MakePhoneCall("+528331607211", "Laura");
    }
    else
    {
        DisplayAlert("Llamada", "No se puede hacer llamada", "Ok");
    }
}

It throws an error:

System.NotlmplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

Deploy stops

Eugene Berdnikov
  • 2,150
  • 2
  • 23
  • 30

3 Answers3

0

Have you tried the Messaging plugin? Like said by Jason here.

JorgeMadson
  • 140
  • 10
0

Try:

Device.OpenUri(new Uri("tel:528331607211"));

Rendy Del Rosario
  • 1,277
  • 10
  • 20
0

If you are using this plugin (I'm not sure if this is the specific one you're using or not), then you need to make the phone call using a Dependency service (This is explained in the plugin readme).

Make a method in your PCL project to call the dependancy service:

private void QCall(string number)
{
    var notificator = DependencyService.Get<IPhoneCall>();
    notificator.MakeQuickCall (number);
}

In each platform specific project, initialize the plugin. For Android, this will be done in the OnCreate method of your MainActivity, and for iOS in AppDelegate in the FinishedLaunching method. Add the following line to each after the initialization of Xamarin.Forms:

PhoneCallImplementation.Init();

Then when you call QCall() in your PCL project it will run the code necessary for the specific platform the user is on.

cvanbeek
  • 1,796
  • 21
  • 30