0

I am just about to release an app and I saw this stackoverflow question about things you should do before releasing an app. It tells me to use ACRA so I followed the instructions on this page.

So know I have a class called MyApplication like so :

import android.app.Application;
import org.acra.*;
import org.acra.annotation.*;

@ReportsCrashes(formKey = "", // will not be used
    mailTo = "c@gmail.com",
    mode = ReportingInteractionMode.TOAST,
    customReportContent = { ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME, ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },   
    resToastText = R.string.crash_report_text)
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // The following line triggers the initialization of ACRA
        ACRA.init(this);
    }
}

Now apparently when my application crashes I think the user is supposed to be able to send the report somehow, so I put a null pointer in my app but it just crashes and nothing happens. Am I supposed to do anything else?

Community
  • 1
  • 1
Ogen
  • 6,499
  • 7
  • 58
  • 124
  • @blackbelt even if it crashes on my emulator? – Ogen Jan 06 '14 at 11:57
  • No its not true as @Clay you have defined the error notification mode as Toast then it should show you the Toast message when the error occurs in your application. – GrIsHu Jan 06 '14 at 12:05
  • Have you registered your application and generated the Key in google console ? – GrIsHu Jan 06 '14 at 12:06
  • No its almost finished. And also, What should I change the notification mode to? There is no email option. – Ogen Jan 06 '14 at 12:06
  • Have you generated `formKey` ? – GrIsHu Jan 06 '14 at 12:08
  • @GrIsHu No I dont know what that is sorry – Ogen Jan 06 '14 at 12:10
  • You need to generate a form on the Google Drive and need create formkey in which your all the crashes will be logged and copy/paste that form key in `formKey` propery and register your application. This way it will log the crash reports. – GrIsHu Jan 06 '14 at 12:12
  • @GrIsHu Im using the email option, not the google docs option. – Ogen Jan 06 '14 at 12:15
  • By default, ACRA silently sends to a Google Docs spreadsheet, although that is deprecated. You could consider 'mode = ReportingInteractionMode.DIALOG'. That allows you to bring up a dialog where you can apologise for the crash and invite the user to add comments and send the report - they can share it out by email (although they can always decline to send a report to you). That also has the advantage of your app not requiring the Internet permission for ACRA to work. – NigelK Jan 06 '14 at 12:20
  • @Clay Check out my answer and follow the steps. – GrIsHu Jan 06 '14 at 12:23

1 Answers1

1

I guess you might not have registered your application on BugSense

Where you want to send the crash reporst that depands on you only. When you are using Google Docs (deprecated now), you have to use your formKey you got from your google docs document.

If you want to store the reports on your own server, you can leave the formKey field blank. The only thing you have to do is to enter a valid url to your server (formUri = ....).

The other strings are for the type of dialog, which should or shouldn't appear.

Instead of using your own server, you can use BugSense. See this thread on stackoverflow.

  • As the use of Google Docs is deprecated for ACRA. I recommend you to use **BugSense** as your Back-End service:

1. Go to their site and sign in: http://www.bugsense.com/

2. Create a new project to monitor in BugSense site, as a result you will receive an API Key for this application.

3. Finally add this line to you Application class in you project:

@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=YOUR_API_KEY", formKey="")

Check out BugSense Docmentation

Community
  • 1
  • 1
GrIsHu
  • 29,068
  • 10
  • 64
  • 102
  • I signed up and got the api key etc etc. I made my app crash but it didnt send anything. Could it be because it doesnt work from an android emulator? It must crash on a real device? – Ogen Jan 06 '14 at 12:41
  • Hey there, it is sending the error successfully to bugsense and I can see it. Thanks a lot. However, the toast is not showing. It just says, unfortunately chess has stopped working. I'd like to let the user know that a crash report has been sent. How can I do this? – Ogen Jan 06 '14 at 13:05
  • You can notify the user's using the Toast message just you need to modify the message of toast. Or you can show the alert dialog mode of notification if you want to show users a notification that crash report is sent. – GrIsHu Jan 06 '14 at 13:18
  • Looks like Bugsense have died ... – TinaFrieda Nov 10 '22 at 20:24