Reputation: 1235
I have an app that needs to prompt the user to open an email that's just been sent to them. It would be a great feature if it automatically opened the email app for them.
I currently have this code to open the email app and create a new draft email:
Device.OpenUri(new Uri("mailto://"));
I need this to run without opening a new email, just take them to their default mail app.
Upvotes: 4
Views: 817
Reputation: 39082
This is not possible to do in a purely cross-platform manner without the mailto://
URI which all systems understand. If you wanted to just open the mail client, you would have to check if your target OS supports such intent / URI and open it in a platform-specific manner.
Update: I have found platform specific solutions for Android and iOS.
Android
var intent = PackageManager.GetLaunchIntentForPackage("com.android.email");
StartActivity(intent);
iOS
UIApplication.SharedApplication.OpenUrl("message://");
UWP
In case of UWP mailto:
seems to be the right option according to Docs. Unfortunately from my testing it does try to create a new e-mail with the built in Outlook Mail app. I will report that as a issue.
Upvotes: 8