diff --git a/osu.Android/OsuGameActivity.cs b/osu.Android/OsuGameActivity.cs index 2b25c37d58..917a39148d 100644 --- a/osu.Android/OsuGameActivity.cs +++ b/osu.Android/OsuGameActivity.cs @@ -1,12 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using System.Threading.Tasks; using Android.App; using Android.Content; using Android.Content.PM; using Android.OS; +using Android.Provider; using Android.Views; using osu.Framework.Android; @@ -39,11 +39,14 @@ protected override void OnNewIntent(Intent intent) { if (intent.Action == Intent.ActionView) { - var filename = intent.Data.Path.Split('/').Last(); + var cursor = ContentResolver.Query(intent.Data, null, null, null); + var filename_column = cursor.GetColumnIndex(OpenableColumns.DisplayName); + cursor.MoveToFirst(); + var stream = ContentResolver.OpenInputStream(intent.Data); if (stream != null) // intent handler may run before the game has even loaded so we need to wait for the file importers to load before launching import - game.WaitForReady(() => game, _ => Task.Run(() => game.Import(stream, filename))); + game.WaitForReady(() => game, _ => Task.Run(() => game.Import(stream, cursor.GetString(filename_column)))); } base.OnNewIntent(intent);