I'm trying to access PDF files from Google drive within my app with the following code:
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("application/pdf");
startActivityForResult(intent, MY_ACTION_OPEN_DOCUMENT);
which was taken from Google's documentation directly. I'm able to get the file picker to appear. However there are 2 problems:
I'm wondering if there is something missing in my implementation. I tried to search the web and surprisingly found nothing relevant. More surprisingly I got the same problem with the gmail app.
Thanks in advance.
Storage access framework does invoke callbacks on active/selected provider (queryDocument and queryChildDocuments). It is up to the Google drive document provider to sync and notify SAF. SAF even supports streaming files of a large size. The sync logic itself is implementation logic dependent on doze mode etc.
In worst case, users can always pull down to refresh on the documents viewer to trigger the same callbacks.
https://medium.com/androiddevelopers/building-a-documentsprovider-f7f2fb38e86a.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With