• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Storage Access Framework & Google Drive

I'm working on an app and want the ability to read/write files in a directory on Google Drive. In the past for local files I use Storage Access Framework with Intent.ACTION_OPEN_DOCUMENT_TREE to get access to a directory and it's files/sub-directories. How do I get the Storage Access Framework interface to show Google drive and not just local memory (device, microSD, usbkeys).

I have seen info on Google Drive REST API but those posts are years old and it seems the Storage Access Framework should support it to make access much easier. Am I missing why it wouldn't be supported or is there something needed to pick a Google account so it knows which Google Drive account to show?

Aka, what is needed beyond:
Code:
val i = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
i.addCategory(Intent.CATEGORY_DEFAULT)
i.flags = Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION and Intent.FLAG_GRANT_WRITE_URI_PERMISSION
startActivityForResult(i, SELECT_CURRENT_DIR)

Thanks,
Gary
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones