hpoul / file_picker_writable

Flutter plugin to choose files which can be read, referenced and written back at a later time.
https://pub.dev/packages/file_picker_writable
MIT License
17 stars 12 forks source link

Android: Fallback for unsupported OPEN_DOCUMENT intent #11

Open hpoul opened 4 years ago

hpoul commented 4 years ago

the OPEN_DOCUMENT intent is only a requirement since android 9. Before that AOSP did not require an app for OPEN_DOCUMENT .. This can be easily worked around by users by installing an app supporting this intent (e.g. https://f-droid.org/en/packages/me.zhanghai.android.files/ )

But the file picker should probably just fall back to ACTION_GET_CONTENT - see also for example https://github.com/signalapp/Signal-Android/commit/6e3751a0c5870f8dc4ad9d210ce08b153c3307bf

2020-10-04 12:10:52.811869 FINE file_picker_writable - Native Log: debug: main exception while launcing file picker  Exception: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT cat=[android.intent.category.OPENABLE] typ=*/* }
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT cat=[android.intent.category.OPENABLE] typ=*/* }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1937)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1616)
    at android.app.Activity.startActivityForResult(Activity.java:4532)
    at androidx.fragment.app.d.startActivityForResult(Unknown Source:10)
    at android.app.Activity.startActivityForResult(Activity.java:4490)
    at androidx.fragment.app.d.startActivityForResult(Unknown Source:10)
    at d.a.a.a.c.o(Unknown Source:35)
    at d.a.a.a.d$b.i(Unknown Source:133)
    at j.d0.j.a.a.j(Unknown Source:8)
    at kotlinx.coroutines.k0.run(Unknown Source:93)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6499)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:442)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)