public string OpenDirectory(string directoryPath) { DebugHandler.TraceMessage("OpenDirectory Called", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage("Directory Path: " + directoryPath, DebugSource.TASK, DebugType.PARAMETERS); try { #if __ANDROID__ Android.Net.Uri uri = Android.Net.Uri.Parse(directoryPath); Android.Content.Intent intent = new Android.Content.Intent(Android.Content.Intent.ActionView); intent.SetDataAndType(uri, "*/*"); intent.SetFlags(Android.Content.ActivityFlags.ClearWhenTaskReset | Android.Content.ActivityFlags.NewTask); Android.App.Application.Context.StartActivity(Android.Content.Intent.CreateChooser(intent, "Choose File Explorer")); #else if (UtilityMethods.CheckOperatingSystems() == UtilityMethods.OperatingSystems.Linux) { Process.Start("xdg-open", directoryPath); } else if (UtilityMethods.CheckOperatingSystems() == UtilityMethods.OperatingSystems.OsX) { Process.Start("open", directoryPath); } else { Process.Start("explorer.exe", directoryPath); } #endif JsonSuccess report = new JsonSuccess() { message = "Succesfully opened folder with path: " + directoryPath }; return(report.ToJson()); } catch (Exception e) { DebugHandler.TraceMessage("Could not open directory: " + e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError jsonError = new JsonError { type = "open_directory_failed", errormessage = "Could not open directory.", errortype = "exception" }; return(jsonError.ToJson()); } }