public class EmailIntentSender extends java.lang.Object implements ReportSender
The user will be asked to chose his preferred email client if no default is set. Included report fields can be defined using
ReportsCrashes.customReportContent()
. Crash receiving mailbox has to be
defined with ReportsCrashes.mailTo()
.
Constructor and Description |
---|
EmailIntentSender(ACRAConfiguration config) |
Modifier and Type | Method and Description |
---|---|
protected android.content.Intent |
buildAttachmentIntent(java.lang.String subject,
java.lang.String body,
java.util.ArrayList<android.net.Uri> attachments,
boolean contentAttached)
Builds an email intent with attachments
|
protected java.lang.String |
buildBody(CrashReportData errorContent)
Creates the message body
|
protected android.content.Intent |
buildResolveIntent(java.lang.String subject,
java.lang.String body)
Builds an intent used to resolve email clients and to send reports without attachments or as fallback if no attachments are supported
|
protected java.lang.String |
buildSubject(android.content.Context context)
Creates the message subject
|
protected android.net.Uri |
createAttachmentFromString(android.content.Context context,
java.lang.String name,
java.lang.String content)
Creates a temporary file with the given content and name, to be used as an email attachment
|
protected boolean |
fillAttachmentList(android.content.Context context,
CrashReportData errorContent,
java.util.List<android.net.Uri> attachments)
Adds all attachment uris into the given list
|
void |
send(android.content.Context context,
CrashReportData errorContent)
Send crash report data.
|
public EmailIntentSender(@NonNull ACRAConfiguration config)
public void send(@NonNull android.content.Context context, @NonNull CrashReportData errorContent) throws ReportSenderException
ReportSender
SenderService
.send
in interface ReportSender
context
- Android Context in which to send the crash report.errorContent
- Stores key/value pairs for each report field.
A report field is identified by a ReportField
enum value.ReportSenderException
- If anything goes fatally wrong during the handling of crash
data, you can (should) throw a ReportSenderException
with a custom message.@NonNull protected android.content.Intent buildAttachmentIntent(@NonNull java.lang.String subject, @NonNull java.lang.String body, @NonNull java.util.ArrayList<android.net.Uri> attachments, boolean contentAttached)
subject
- the message subjectbody
- the message bodyattachments
- the attachmentscontentAttached
- if the body is already contained in the attachments@NonNull protected android.content.Intent buildResolveIntent(@NonNull java.lang.String subject, @NonNull java.lang.String body)
subject
- the message subjectbody
- the message body@NonNull protected java.lang.String buildSubject(@NonNull android.content.Context context)
context
- a context@NonNull protected java.lang.String buildBody(@NonNull CrashReportData errorContent)
errorContent
- the report contentprotected boolean fillAttachmentList(@NonNull android.content.Context context, @NonNull CrashReportData errorContent, @NonNull java.util.List<android.net.Uri> attachments)
context
- a contexterrorContent
- the report contentattachments
- the target list@Nullable protected android.net.Uri createAttachmentFromString(@NonNull android.content.Context context, @NonNull java.lang.String name, @NonNull java.lang.String content)
context
- a contextname
- the namecontent
- the content