03-14-2024, 05:20 AM
I use the pretty standard approach to invoking the storage access framework to pick a destination to save a file:
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, defaultName);
startActivityForResult(intent, code);
It works perfectly fine for local destinations, but the result can be completely different on devices from different manufacturers (and across OS versions). I don't have control over how the storage access framework functions or how the UI appears. Applications on the device have to act as content providers for the ACTION_CREATE_DOCUMENT intent in order to show up as an option. By comparison, when selecting a file for restore, I can use Intent.ACTION_GET_CONTENT which is more widely supported across apps.
Mike
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_TITLE, defaultName);
startActivityForResult(intent, code);
It works perfectly fine for local destinations, but the result can be completely different on devices from different manufacturers (and across OS versions). I don't have control over how the storage access framework functions or how the UI appears. Applications on the device have to act as content providers for the ACTION_CREATE_DOCUMENT intent in order to show up as an option. By comparison, when selecting a file for restore, I can use Intent.ACTION_GET_CONTENT which is more widely supported across apps.
Mike