Hello,
Xamarin.Essentials.Launcher enables your app to open a URI by system. From the source code, we can see that it uses UIApplication.CanOpenUrl(NSUrl) method in iOS. Your uri is "mailto:" + email
, it starts with mailto:
, it means that your app only could open Mail in your iOS device by system. If Mail is not installed, a prompt box will pop up asking whether to download Mail, which is a system behavior.
My required is to send an email with any email app such as Gmail, outlook or any other application installed on phone.
If you want to open other apps, you need to specify LSApplicationQueriesSchemes in your Info.plist
file. Scheme name of Microsoft Outlook is ms-outlook
, and you can open Outlook by await Launcher.OpenAsync(new Uri("ms-outlook://XXXXXX"));
. But if you haven't installed this app, it won't pop up the prompt to download automatically, you need to open the download page in App Store : await Launcher.OpenAsync(new Uri("itms-apps://apps.apple.com/us/app/microsoft-outlook/id951937596"));
Refer to
bool canopen = await Launcher.CanOpenAsync(new Uri("ms-outlook://XXX"));
if (canopen)
{
await Launcher.OpenAsync(new Uri("ms-outlook://XXX"));
}
else {
await Launcher.OpenAsync(new Uri("itms-apps://apps.apple.com/us/app/microsoft-outlook/id951937596"));
}
You can also open other apps if you have set the scheme name and customize the URI, please search for the URLs you're interested in to LSApplicationQueriesSchemes
.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.