Android Email Multiple Attachment issue on HTC Thunderbolt
Asked Answered
D

3

24

I have a weird situation here.

I am trying to send emails with multiple attachments using the following piece of code.

Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND_MULTIPLE );
// emailIntent.setType( "plain/text" );
emailIntent.setType( "application/octet-stream" );
...
....
emailIntent.putParcelableArrayListExtra( Intent.EXTRA_STREAM, uris );

This works fine and the implicit intent mechanism shows up a lot of options like Gmail, Skype, Messaging etc.

The problem is that the default Mail client does not show up on HTC Thunderbolt ( but works on other devices including HTC Incredible S ).

If I try to send a single attachment using Intent.ACTION_SEND, the default mail client shows up. I have tried setting content type to text/plain, appliation/octet-stream, message/rfc282 etc but none works.

What am I missing here?

Deluna answered 27/2, 2012 at 6:47 Comment(2)
At the end I bundled up all attachments to a zip file and upload that zip file.Deluna
Have you tried this? #4553331Poston
I
0

Sounds like a bug in the Thunderbolt's version of Sense. Custom UIs for the win, am I right?

Anyway, I would look up what app actually does handle emails on the thunderbolt and put an if-statement to detect if the device is a thunderbolt. If it is, set the Intent's target class to whatever that is. If it's not, do what you're already doing.

Intercommunion answered 30/7, 2012 at 17:5 Comment(0)
L
0

This works great for me, be sure to specify the the message type, that is how the android os knows which broadcast to use.

     String email = "[email protected]";
    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.setType("message/rfc822");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] {email}); // could have multiple address
    intent.putExtra(Intent.EXTRA_SUBJECT, "Enter your subject here");
    intent.putExtra(Intent.EXTRA_TEXT, "message text as needed");
    ArrayList<Uri> arrayUri = new ArrayList<Uri>();
    arrayUri.add(Uri.parse("file://" + paths[0]));
    arrayUri.add(Uri.parse("file://" + paths[1]));
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, arrayUri);
    startActivity(Intent.createChooser(intent, "Any title to show on chooser"));
Leasehold answered 3/2, 2014 at 13:10 Comment(0)
M
0

Try this. I think it will work.

final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("plain/text");

ArrayList<Uri> uris = new ArrayList<Uri>();

String[] filePaths = new String[] {image1 Path,image2 path};
for (String file : filePaths) {
    File fileIn = new File(file);
    Uri u = Uri.fromFile(fileIn);
    uris.add(u);
}

if ( !(app_preferences.getString("email", "") == null || app_preferences.getString("email", "").equals(""))) {
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {app_preferences.getString("email", "")});    
}

emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject name");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Please find the attachment.");
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

startActivity(Intent.createChooser(emailIntent, "Email:"));
Monro answered 18/12, 2014 at 5:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.