Hello,
You can use Conditional compilation, do not need to create interface and invoke platform code.
You can run this iOS and Android platform code directly with conditional compilation in the MAUI. For example, I execute this code in the button click event like following code.
private async void OnCounterClicked(object sender, EventArgs e)
{
#if ANDROID
var intent=new Android.Content.Intent(Android.Provider.Settings.ActionApplicationSettings);
intent.AddFlags(Android.Content.ActivityFlags.NewTask);
var uri= Android.Net.Uri.FromParts("package", package_name,null);
intent.SetData(uri);
#elif IOS
var url = new Foundation.NSUrl($"app-settings:{app_bundle_id}");
UIKit.UIApplication.SharedApplication.OpenUrl(url);
#endif }
Best Regards,
Leon Lu
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.