Composing an email through Java Android - Trying to target device management client

29 Views Asked by At

I have developed an application that captures an image and adds an overlay of information onto the image. The business would like the image to be sent via email. I am working in a business and the way in which they would like to send the email is through the MaaS360 device management client on the device which is sending the email for security reasons.

I have successfully implemented the code to send an email with the image attached. Here is the code:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("S/MIME");
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{"[email protected]"});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
fileLoc = file.getAbsolutePath();
SharedPreferences info = this.getSharedPreferences("info", MODE_PRIVATE);
info.edit().putString("info", fileLoc).commit();
File file = new File(fileLoc);
if (!file.exists() || !file.canRead()) {
Toast.makeText(this, "Attachment Error", Toast.LENGTH_LONG).show();
finish();
return;
}
Uri uri = Uri.fromFile(file);
i.putExtra(Intent.EXTRA_STREAM, uri);
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(Camera1.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}

When it comes to sending the email the device prompts for which application to use to send the email based on which mime type we have set. I have tried multiple mime types but the Maas360 client never shows in the options list.

Does anyone know how I can get it to show in the list?

Appreciate the help!

1

There are 1 best solutions below

0
On

Maas360 does not support the auto-population of attachments the same way an email client like GMAIL would.