Back to Acra

EmailIntentSender

web/static/javadoc/5.2.1/org/acra/sender/EmailIntentSender.html

latest12.1 KB
Original Source

Skip navigation links

org.acra.sender

Class EmailIntentSender


public classEmailIntentSenderextends[Object](http://d.android.com/reference/java/lang/Object.html?is-external=true "class or interface in java.lang")implements[ReportSender](../../../org/acra/sender/ReportSender.html "interface in org.acra.sender")

Send reports through an email intent.

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().

Field Summary

Fields | Modifier and Type | Field and Description | | --- | --- | | static String | DEFAULT_REPORT_FILENAME |

Constructor Summary

Constructors | Constructor and Description | | --- | | EmailIntentSender(CoreConfiguration config) |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method and Description | | --- | --- | | protected Intent | buildAttachmentIntent(String subject, String body, ArrayList<Uri> attachments, boolean contentAttached) 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 body, List<Uri> attachments) Adds all attachment uris into the given list | | void | send(Context context, CrashReportData errorContent) Send crash report data. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

DEFAULT_REPORT_FILENAME

public static final[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")DEFAULT_REPORT_FILENAME

See Also:Constant Field Values

Constructor Detail

- 

EmailIntentSender

public EmailIntentSender([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[CoreConfiguration](../../../org/acra/config/CoreConfiguration.html "class in org.acra.config")config)

Method Detail

- 

send

public void send([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Context](http://d.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[CrashReportData](../../../org/acra/data/CrashReportData.html "class in org.acra.data")errorContent)
          throws[ReportSenderException](../../../org/acra/sender/ReportSenderException.html "class in org.acra.sender")

Description copied from interface: ReportSender

Send crash report data.

Method will be called from the SenderService.

Specified by:send in interface ReportSenderParameters:context - Android Context in which to send the crash report.errorContent - Stores key/value pairs for each report field.Throws:ReportSenderException - If anything goes fatally wrong during the handling of crash data, you can (should) throw a ReportSenderException with a custom message.

- 

buildAttachmentIntent

[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")protected[Intent](http://d.android.com/reference/android/content/Intent.html?is-external=true "class or interface in android.content")buildAttachmentIntent([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")subject,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")body,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[ArrayList](http://d.android.com/reference/java/util/ArrayList.html?is-external=true "class or interface in java.util")<[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")> attachments,
                                                boolean contentAttached)

Builds an email intent with attachments Parameters:subject - the message subjectbody - the message bodyattachments - the attachmentscontentAttached - if the body is already contained in the attachmentsReturns:email intent

- 

buildResolveIntent

[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")protected[Intent](http://d.android.com/reference/android/content/Intent.html?is-external=true "class or interface in android.content")buildResolveIntent([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")subject,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")body)

Builds an intent used to resolve email clients and to send reports without attachments or as fallback if no attachments are supported Parameters:subject - the message subjectbody - the message bodyReturns:email intent

- 

buildSubject

[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")protected[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")buildSubject([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Context](http://d.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context)

Creates the message subject Parameters:context - a contextReturns:the message subject

- 

fillAttachmentList

protected boolean fillAttachmentList([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Context](http://d.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")body,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[List](http://d.android.com/reference/java/util/List.html?is-external=true "class or interface in java.util")<[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")> attachments)

Adds all attachment uris into the given list Parameters:context - a contextbody - the report contentattachments - the target listReturns:if the attachments contain the content

- 

createAttachmentFromString

[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")protected[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")createAttachmentFromString([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Context](http://d.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")name,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")content)

Creates a temporary file with the given content and name, to be used as an email attachment Parameters:context - a contextname - the namecontent - the contentReturns:a content uri for the file

Skip navigation links