public class EmailIntentSender extends 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
AcraCore.reportContent()
. Crash receiving mailbox has to be
defined with AcraMailSender.mailTo()
.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_REPORT_FILENAME |
Constructor and Description |
---|
EmailIntentSender(CoreConfiguration config) |
Modifier and Type | Method and Description |
---|---|
protected Intent |
buildAttachmentIntent(String subject,
String body,
ArrayList<Uri> attachments)
Builds an email intent with attachments
|
protected Intent |
buildResolveIntent(String subject,
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 String |
buildSubject(Context context)
Creates the message subject
|
protected Uri |
createAttachmentFromString(Context context,
String name,
String content)
Creates a temporary file with the given content and name, to be used as an email attachment
|
protected boolean |
fillAttachmentList(Context context,
String reportText,
List<Uri> attachments)
Adds all attachment uris into the given list
|
boolean |
requiresForeground() |
void |
send(Context context,
CrashReportData errorContent)
Send crash report data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
send
public static final String DEFAULT_REPORT_FILENAME
public EmailIntentSender(@NonNull CoreConfiguration config)
public void send(@NonNull Context context, @NonNull CrashReportData errorContent) throws ReportSenderException
ReportSender
Method will be called from the LegacySenderService
.
send
in interface ReportSender
context
- Android Context in which to send the crash report.errorContent
- Stores key/value pairs for each report field.ReportSenderException
- If anything goes fatally wrong during the handling of crash data, you can (should) throw a ReportSenderException
with a custom message.public boolean requiresForeground()
requiresForeground
in interface ReportSender
@NonNull protected Intent buildAttachmentIntent(@NonNull String subject, @Nullable String body, @NonNull ArrayList<Uri> attachments)
subject
- the message subjectbody
- the message bodyattachments
- the attachments@NonNull protected Intent buildResolveIntent(@NonNull String subject, @NonNull String body)
subject
- the message subjectbody
- the message body@NonNull protected String buildSubject(@NonNull Context context)
context
- a contextprotected boolean fillAttachmentList(@NonNull Context context, @NonNull String reportText, @NonNull List<Uri> attachments)
context
- a contextreportText
- the report contentattachments
- the target list@Nullable protected Uri createAttachmentFromString(@NonNull Context context, @NonNull String name, @NonNull String content)
context
- a contextname
- the namecontent
- the content