Android Question Send/Receive file to/from a specific application OR Google Drive

adriano.freitas

Active Member
Hi!

Is there a way inside my application at a given moment to ask the user to select a file (content chooser) but define which application this file will come from?
Is there also a way to share a file but limit the applications that can receive the one I'm sending?

I ask because I needed the user to be able to send a file to any of the folders on his google drive and also choose a file from among those on google drive for reading, but I didn't want to give him the chance to send or open other applications... I researched a lot about using google drive to save/read files directly, but I don't have much knowledge about these platforms yet and I'm very confused, I couldn't find any practical example, so I decided to go for this solution to use sharing and content chooser. Can anyone help me with either an example from Google Drive or this information about sharing and contentchooser?

Thank you!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is there a way inside my application at a given moment to ask the user to select a file (content chooser) but define which application this file will come from?
Not with ContentChooser. You can use Google Drive REST API + OAuth 2 to have more control.

Is there also a way to share a file but limit the applications that can receive the one I'm sending?
You can use PackageManager.QueryIntentActivities to get the possible targets and then build your own list instead of letting the user choose from the system list.
 
Upvote 0

adriano.freitas

Active Member
Not with ContentChooser. You can use Google Drive REST API + OAuth 2 to have more control.


You can use PackageManager.QueryIntentActivities to get the possible targets and then build your own list instead of letting the user choose from the system list.

Thank you very much for your attention! I'll try to follow the tips, but about creating my own target list to receive my file, any example tips? I have no idea how to do it!

Thanks a lot for the help!
 
Upvote 0
Top