public NativeFileSystem() { int storagePathLength; RootPath = FindRootPath(out storagePathLength); if (RootPath == null) { StringBuilder sb = new StringBuilder(); sb.AppendLine("Content directory was not found!"); sb.AppendLine(); sb.AppendLine("Searched mount points:"); List <StorageInfo> storages = GetStorageList(); for (int i = storages.Count - 1; i >= 0; i--) { sb.Append(" - "); sb.Append(storages[i].Path); sb.Append(" ("); if (storages[i].IsReadOnly && storages[i].IsRemovable) { sb.Append("Read-only removable"); } else if (storages[i].IsReadOnly) { sb.Append("Read-only fixed"); } else if (storages[i].IsRemovable) { sb.Append("Removable"); } else { sb.Append("Fixed"); } sb.AppendLine(")"); } CrashHandlerActivity.ShowErrorDialog(new DirectoryNotFoundException(sb.ToString())); } App.Log("Android Root Path: " + RootPath); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); weakActivity = new WeakReference <MainActivity>(this); CrashHandlerActivity.Register(this); Window.AddFlags(WindowManagerFlags.KeepScreenOn); try { View decorView = Window.DecorView; decorView.SystemUiVisibility |= (StatusBarVisibility)SystemUiFlags.LayoutStable; decorView.SystemUiVisibility |= (StatusBarVisibility)SystemUiFlags.LayoutFullscreen; decorView.SystemUiVisibility |= (StatusBarVisibility)SystemUiFlags.Immersive; // Minimal supported SDK is already 18 //if ((int)Build.VERSION.SdkInt < 18) // RequestedOrientation = ScreenOrientation.SensorLandscape; Window.ClearFlags(WindowManagerFlags.TranslucentStatus); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.SetStatusBarColor(new Color(0)); } } catch /*(Exception ex)*/ { #if DEBUG throw; #endif } // Create our OpenGL view and show it InnerView = new InnerView(this); SetContentView(InnerView); }
public NativeFileSystem() { string packageName = Application.Context.PackageName + "/"; List <StorageInfo> storages = GetStorageList(); for (int i = storages.Count - 1; i >= 0; i--) { string path = Path.Combine(storages[i].Path, "Android", "Data", packageName); if (Directory.Exists(path)) { RootPath = path; break; } path = Path.Combine(storages[i].Path, packageName); if (Directory.Exists(path)) { RootPath = path; break; } // ToDo: Remove this in future versions path = Path.Combine(storages[i].Path, "Download", packageName); if (Directory.Exists(path)) { RootPath = path; break; } } if (RootPath == null) { //throw new DirectoryNotFoundException("Content directory was not found"); StringBuilder sb = new StringBuilder(); sb.AppendLine("Content directory was not found!"); sb.AppendLine(); sb.AppendLine("Searched mount points:"); for (int i = storages.Count - 1; i >= 0; i--) { sb.Append(" - "); sb.Append(storages[i].Path); sb.Append(" ("); if (storages[i].IsReadOnly && storages[i].IsRemovable) { sb.Append("Read-only removable"); } else if (storages[i].IsReadOnly) { sb.Append("Read-only fixed"); } else if (storages[i].IsRemovable) { sb.Append("Removable"); } else { sb.Append("Fixed"); } sb.AppendLine(")"); } CrashHandlerActivity.ShowErrorDialog(new DirectoryNotFoundException(sb.ToString())); } Console.WriteLine("Android Root Path: " + RootPath); }