Search code examples
androidandroid-4.4-kitkatsamsung-touchwizstorage-access-framework

KitKat ACTION_OPEN_DOCUMENT does not show documents on Samsung devices


I'm using the new Kitkat Storage Access Framework (SAF) as specified here: https://developer.android.com/guide/topics/providers/document-provider.html

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(intent, 0);

This is the same as the example code but the images filter is not working. Nothing shows up on the S5 or the Note3. The same happens for video (video/*). I also tried different patterns like / to not avail.

This looks like a Samsung issue that should be addressed by them, I'm just wondering if anyone knows a workaround.


Solution

  • I had the same on my Galaxy S4, and the only workaround I found was to reuse the old way:

    Intent photoPickerIntent = new Intent();    
    photoPickerIntent.setAction(Intent.ACTION_GET_CONTENT);
    photoPickerIntent.setType("image/*");
    startActivityForResult(photoPickerIntent, 0);
    

    But I suppose you first want to be sure to be on the specific device, since it works well with the Intent.ACTION_OPEN_DOCUMENT on other devices ... (I tried on Wiko Cink Slim and Nexus 5, with Android 4.4.2).

    Hope it helps you