1

I have a list of entries each of which represents a file. I want to add an button to each of them to send it to an app (to upload it to Google Drive, DropBox, send it via email, whathaveyou). I've looked at the Android documentation dealing with file sharing (http://developer.android.com/training/secure-file-sharing/share-file.html), but all it describes (as I understand it) is how to allow other apps to request files from your app:

Once you have set up your app to share files using content URIs, you can respond to other apps' requests for those files. One way to respond to these requests is to provide a file selection interface from the server app that other applications can invoke.

But I don't want users to first have to go to another app and request files from there, I want it to work like the share button in photo galleries for example - click on Upload to Google Drive and have the little upload dialog pop up, or click on Send via Gmail and the Gmail app opens with the file already attached like I can do with photos from the gallery app.

How can I accomplish this? I'm not asking for step-by-step instructions here, just a pointer towards how that kind of sharing is done. I'm sure I'm missing something in the Android documentation or I'm looking at the wrong thing entirely.

TimSim
  • 3,936
  • 7
  • 46
  • 83

1 Answers1

3

intent.setPackage() - Set your package (make sure to check if the package exists or not).

for Google Drive - intent.setPackage("com.google.android.apps.docs");

for Gmail - com.google.android.gm

Here's a precise answer.

Community
  • 1
  • 1
Froyo
  • 17,947
  • 8
  • 45
  • 73