org.acra
Class CrashReportingApplication

java.lang.Object
  extended by Application
      extended by org.acra.CrashReportingApplication

public abstract class CrashReportingApplication
extends Application

Base class for any application which need to send crash reports. The final application has to extend this class and at least implement the abstract method getFormId() by returning a valid GoogleDocs Form id string generated by importing ACRA's specific spreadsheet template.

If you prefer sending crash reports to your own script on your own server, you can override getFormUri() and return any Url string to your sever script (like : "http://www.myserver.com/myscript.php").

If some crash reports could not be sent (due to technical issues like loss of network connection), their data is stored in the application private filesystem and sent on the next Application start. This means that the reports might be sent quite some time after the crash, because a crash causes the Activity to be destroyed but not the Application.

If you would like to receive reports as soon as possible, you may want to call ErrorReporter.checkReportsOnApplicationStart() on ErrorReporter.getInstance() in your main Activity onCreate() method.


Field Summary
static int NOTIF_CRASH_ID
          This is the identifier (value = 666) use for the status bar notification issued when crashes occur.
static java.lang.String PREF_DISABLE_ACRA
          The key of the application default SharedPreference where you can put a 'true' Boolean value to disable ACRA.
static java.lang.String RES_DIALOG_COMMENT_PROMPT
          Bundle key for the user comment input label in the crash dialog.
static java.lang.String RES_DIALOG_ICON
          Bundle key for the icon in the crash dialog.
static java.lang.String RES_DIALOG_OK_TOAST
          Bundle key for the Toast text triggered when the user accepts to send a report in the crash dialog.
static java.lang.String RES_DIALOG_TEXT
          Bundle key for the text in the crash dialog.
static java.lang.String RES_DIALOG_TITLE
          Bundle key for the title in the crash dialog.
static java.lang.String RES_NOTIF_ICON
          Bundle key for the icon in the status bar notification.
static java.lang.String RES_NOTIF_TEXT
          Bundle key for the text in the status bar notification.
static java.lang.String RES_NOTIF_TICKER_TEXT
          Bundle key for the ticker text in the status bar notification.
static java.lang.String RES_NOTIF_TITLE
          Bundle key for the title in the status bar notification.
static java.lang.String RES_TOAST_TEXT
          Bundle key for the Toast text triggered when the application crashes if the notification+dialog mode is not used.
 
Constructor Summary
CrashReportingApplication()
           
 
Method Summary
 Bundle getCrashResources()
          Override this method to activate user notifications.
abstract  java.lang.String getFormId()
          Implement this method by returning a String containing the id of a valid GoogleDocs Form.
 Uri getFormUri()
           Override this method to send the crash reports to your own server script.
 void onCreate()
           
 void onSharedPreferenceChanged(SharedPreferences sharedPreferences, java.lang.String key)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RES_NOTIF_ICON

public static final java.lang.String RES_NOTIF_ICON
Bundle key for the icon in the status bar notification.

See Also:
getCrashResources(), Constant Field Values

RES_NOTIF_TICKER_TEXT

public static final java.lang.String RES_NOTIF_TICKER_TEXT
Bundle key for the ticker text in the status bar notification.

See Also:
getCrashResources(), Constant Field Values

RES_NOTIF_TITLE

public static final java.lang.String RES_NOTIF_TITLE
Bundle key for the title in the status bar notification.

See Also:
getCrashResources(), Constant Field Values

RES_NOTIF_TEXT

public static final java.lang.String RES_NOTIF_TEXT
Bundle key for the text in the status bar notification.

See Also:
getCrashResources(), Constant Field Values

RES_DIALOG_ICON

public static final java.lang.String RES_DIALOG_ICON
Bundle key for the icon in the crash dialog.

See Also:
getCrashResources(), Constant Field Values

RES_DIALOG_TITLE

public static final java.lang.String RES_DIALOG_TITLE
Bundle key for the title in the crash dialog.

See Also:
getCrashResources(), Constant Field Values

RES_DIALOG_TEXT

public static final java.lang.String RES_DIALOG_TEXT
Bundle key for the text in the crash dialog.

See Also:
getCrashResources(), Constant Field Values

RES_DIALOG_COMMENT_PROMPT

public static final java.lang.String RES_DIALOG_COMMENT_PROMPT
Bundle key for the user comment input label in the crash dialog. If not provided, disables the input field.

See Also:
getCrashResources(), Constant Field Values

RES_DIALOG_OK_TOAST

public static final java.lang.String RES_DIALOG_OK_TOAST
Bundle key for the Toast text triggered when the user accepts to send a report in the crash dialog.

See Also:
getCrashResources(), Constant Field Values

RES_TOAST_TEXT

public static final java.lang.String RES_TOAST_TEXT
Bundle key for the Toast text triggered when the application crashes if the notification+dialog mode is not used.

See Also:
getCrashResources(), Constant Field Values

NOTIF_CRASH_ID

public static final int NOTIF_CRASH_ID
This is the identifier (value = 666) use for the status bar notification issued when crashes occur.

See Also:
Constant Field Values

PREF_DISABLE_ACRA

public static final java.lang.String PREF_DISABLE_ACRA
The key of the application default SharedPreference where you can put a 'true' Boolean value to disable ACRA.

See Also:
Constant Field Values
Constructor Detail

CrashReportingApplication

public CrashReportingApplication()
Method Detail

onCreate

public void onCreate()

getFormUri

public Uri getFormUri()

Override this method to send the crash reports to your own server script. Your script will have to get HTTP POST request parameters named as described in ErrorReporter source code (*_KEY fields values).

If you override this method with your own url, your implementation of the abstract getFormId() can be empty as it will not be called by any other method or object.

Returns:
A String containing the Url of your custom server script.

getFormId

public abstract java.lang.String getFormId()
Implement this method by returning a String containing the id of a valid GoogleDocs Form.

Returns:
The Id of your GoogleDoc Form generated by importing ACRA's spreadsheet template.

getCrashResources

public Bundle getCrashResources()
Override this method to activate user notifications. Return a Bundle containing :

Returns:
A Bundle containing the resource Ids necessary to interact with the user.

onSharedPreferenceChanged

public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
                                      java.lang.String key)