We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
Craig M.21
10 years agoNew member | Level 2
Dropbox should respond to Android Intent.ACTION_SEND
My android app uses the code below to allow users to back up an important file. A number of applications, including Google Drive, appear as suitable services to handle the file, but Dropbox does not appear, even though it offers the same functionality as Google Drive. Could you please change Dropbox so that it appears and my users can access it in this way?
File F = new File(sdPath);
if(F.exists()){
Uri U = Uri.fromFile(F);
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("file/*");
i.putExtra(Intent.EXTRA_STREAM, U);
startActivity(Intent.createChooser(i,"Email/Upload '" + filename + "'"));
}
15 Replies
- Steve M.10 years ago
Dropbox Staff
The Android app doesn't support the MIME type file/*, but we do support these ones:
- application/*
- audio/*
- image/*
- text/*
- video/*
- multipart/*
- Craig M.2110 years agoNew member | Level 2
Thanks for the response. Using "application/*" appears to have soled the upload issue. Is there any good reason that "file/*" is not supported? Many android code samples recommend "file/*' for non-standard file types and my first impulse on not seeing Dropbox n the list was actually to tell my users to use Google Drive instead of Dropbox.
I have been unable to test the integrity of the uploaded file because Dropbox is producing another problem on attempted download (a problem I did not face with Google Drive) - but I will post that as a separate issue.
- Steve M.10 years ago
Dropbox Staff
I wasn't aware of the convention around using "file/*", but I'll pass this along to the team. If that's the recommendation on Android, I imagine we can add support in a future version of the app.
- Craig M.2110 years agoNew member | Level 2
Hi there, it is not so much an official recommendation as a common feature of code snippets provided at places like Stack Exchange. Since it works well with lots of other apps (email, Google Drive, and so on), DropBox is the odd one out. The use of 'application' seems to be a fine substitute, but some developers will not bother looking for a DropBox-specific solution.
- Steve M.10 years ago
Dropbox Staff
Do you happen to have any links handy to where people are using "file/*"? I'm trying to figure out how common it is.
We may simply be able to support "*/*", which is what it appears Google Drive does.
- Craig M.2110 years agoNew member | Level 2
Actually, looking around now, it does not seem to be common. I think I picked up 'file/*' from snippets provided for getting content, not sending content, but then combined it with other snippets designed for sending plain text or images. My specific requirement is that I wanted an all-purpose attachment/upload service, not one restricted to any known file type, and 'application/*' achieves this. The thing is, the above code worked immediately for a wide range of apps/services, so I almost stopped at that point and assumed DropBox was not willing to play ball.
I guess if you respond to */* that should be enough to satisfy other developers who try file/*, but in truth there might not be many. If there is no reason not to respond to */*, though, you might as well be flexible. DropBox doesn't seem to care what type of file it is, so why filter it?
Anyway, thanks for your help - you solved the issue for me.
- Steve M.10 years ago
Dropbox Staff
Okay, thanks. The team will continue investigating whether it makes sense to just support
\*/\*
in the future. - ricardo s.1810 years agoNew member | Level 1
Hello, i have a problem with my app. When i try to share a .zip file with dropbox it doesn´t work. This is my code that should allow to share with gmail, dropbox, gdrive, etc.:
This code works for gmail and gdrive but it doesn´t work for dropbox.Can you help me?, what is the problem?
Intent emailIntent = new Intent(Intent.ACTION_SEND);
String aEmailList[] = { " };
String aEmailCCList[] = { "};
String aEmailBCCList[] = { " };
emailIntent.putExtra(Intent.EXTRA_EMAIL, aEmailList);
emailIntent.putExtra(Intent.EXTRA_CC, aEmailCCList);
emailIntent.putExtra(Intent.EXTRA_BCC, aEmailBCCList);
boolean plus = Tienda.personalizarEmailAdquirido(actividad);
emailIntent.putExtra(Intent.EXTRA_SUBJECT,plus?
PersonalizacionTextos.getTextoEmail(actividad,PersonalizacionTextos.ASUNTO_BACKUP):
actividad.getString(R.string.txsubjectbackup));
emailIntent.putExtra(Intent.EXTRA_TEXT, plus?
PersonalizacionTextos.getTextoEmail(actividad,PersonalizacionTextos.MENS_BACKUP):
actividad.getString(R.string.txbodybackup));
ExternalStorageState eSs = new ExternalStorageState(actividad.getString(R.string.app_directoryname));
if(eSs.isPresentString(eSs.getPathWithoutCreate("backup"))){
try {
File directorioToFind = new File(eSs.getPathWithoutCreate("backup"));
String ficheroZipeado = eSs.getPath("backup.zip","zip");
NZipCompresser nZc = new NZipCompresser(directorioToFind,ficheroZipeado);
nZc.compress();
String uri = "file://" + ficheroZipeado;
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse (uri));
emailIntent.setType("application/zip");
} catch (Exception e) {
NotificationSender nM = new NotificationSender(actividad,"Error en zip","Error en zip,"+e.getMessage());
nM.sendNotification();
}
actividad.startActivity(Intent.createChooser(emailIntent,")); - Bostek10 years agoNew member | Level 1
I have the same problem... ACTION_SEND doesn't work anymore. Any suggestions?
- Adrien B.110 years agoHelpful | Level 6
That was a little pain, but I found a temporary workaround.
It looks like the last update broke a little bit of its Intent parsing.If you want a Dropbox share to work (currently 2016/05/09), you'll have to remove the EXTRA_TEXT from your Intent.
The following exemple works, but it ruins the mail share :
Uncomment the line to see the Dropbox app bad behaviour.Intent intentShareFile = new Intent(Intent.ACTION_SEND);
intentShareFile.setType("application/pdf");
intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(myFile));
intentShareFile.putExtra(Intent.EXTRA_SUBJECT, "My subject");
// intentShareFile.putExtra(Intent.EXTRA_TEXT, "My text");
startActivity(Intent.createChooser(intentShareFile, "Choose"));It seems that a few apps sadly choosed to remove this Extra to make Dropbox works.
This thread is still relevant : Dropbox should properly parse and propery respond to an Intent.SHARE.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 12 hours ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!