Android TV Emulator FilePicker does not work

Oleksii Kovalchuk 70 Reputation points
2023-07-26T08:54:13.3433333+00:00

Hello guys!

I have .NET MAUI application for Android TV that needs a way to open JSON files from a flash drive, connected to the device, using FilePicker. For development purposes I have created Android TV Emulator (Android 9.0 - API 28) x86.

After I prompt and grant StorageRead permission I call this:

var configFile = await FilePicker.Default.PickAsync(new PickOptions { PickerTitle = "please select json file", FileTypes = new(new Dictionary<DevicePlatform, IEnumerable<string>> { { DevicePlatform.Android, new[] { MediaTypeNames.Application.Json } } }) });

But at the bottom of my screen I got notification: No apps can perform this action. and configFile is null.

Apparently that's because my Android TV Emulator is missing file explorer. So I've downloaded Files by Google APK for x86, and installed it using the following command:

adb install "C:\Users\admin\Downloads\com.google.android.apps.nbu.files_1.856.549219070-536268_minAPI21(x86)(nodpi)_apkmirror.com.apk"

I gave Files by Google permissions to read storage so it works like a charm.

But my app is still displaying No apps can perform this action. .

It seems like I have to configure Android to use Files by Google as a default file explorer but I didn't manage to find a way to set that in Settings (that are very limited comparing to a regular Android OS).

Kinda stuck with that.

Thanks!

Developer technologies .NET .NET MAUI
Developer technologies .NET Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.