DarkW1nter
DarkW1nter

Reputation: 2861

Xamarin Forms - click on label containing email address and open in an email app

In Xamarin Forms I have added a gesture recognizer to let a user click on an email address label and have it open an email application.

On Android this works, the user is asked of they want to open in gmail or an email application, but nothing happens on ios.

Is there something ios-specific I have to do to handle this?

var emailGestureRecognizer = new TapGestureRecognizer();
emailGestureRecognizer.Tapped += (s, e) =>
{
        Device.OpenUri(new Uri("mailto:" + venue.ContactEmail));
};
ContactLabel.GestureRecognizers.Add(emailGestureRecognizer);

Upvotes: 2

Views: 1286

Answers (1)

Gerald Versluis
Gerald Versluis

Reputation: 34148

Based on the Apple documentation, this is correct.

iOS Note: If the Mail app is not installed, clicking a mailto URL displays an appropriate warning message to the user.

Since the Mail (and Phone and possibly others) app is not installed on the Simulator, these links will not work.

Upvotes: 1

Related Questions