I am trying to add the crash dump sent to me my email support using acra.
I believe there is an option to show a dialog on restart of app.
Below is my reportCrash
#ReportsCrashes(formKey="dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ",
mode = ReportingInteractionMode.DIALOG,
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_toast_text, // optional, displayed as soon as the crash occurs, before collecting data which can take a few seconds
resDialogText = R.string.crash_dialog_text,
resDialogIcon = android.R.drawable.ic_dialog_info, //optional. default is a warning sign
resDialogTitle = R.string.crash_dialog_title, // optional. default is your application name
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional. when defined, adds a user text field input with this text resource as a label
resDialogOkToast = R.string.crash_dialog_ok_toast // optional. displays a Toast message when the user accepts to send a report.
)
I don't think there is an option to show the dialog on restart of your app, it normally shows when the crash occurs before the app is killed. But the config that you have there looks correct for dialog display.
One word of warning, the use of Google docs to capture the crash reports is now deprecated. You should look for another crash reporting back end like Acralyzer.
Related
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?
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
I am trying to configure ACRA for the first time. I have followed the Basic Setup guide :
1.Integrated the acra jar file to my app
2.Created a new class extending application class and have added the below code to it :
#ReportsCrashes(formKey = "", // will not be used
mailTo = "mymailId#gmail.com")
public class MyApplication extends Application
{
#Override
public void onCreate()
{
super.onCreate();
ACRA.init(this);
}
}
3.Made all necessary changes to manifest file
It seems that all is done correctly,I am able to get the below in logcat :
12-21 14:59:10.994: D/ACRA(28728): ACRA is enabled for com.android.demo.notepad1, intializing...
12-21 14:59:11.064: D/ACRA(28728): Using default Mail Report Fields
12-21 14:59:11.064: D/ACRA(28728): Looking for error files in /data/data/com.android.demo.notepad1/files
12-21 14:59:11.074: W/ACRA(28728): **com.android.demo.notepad1 reports will be sent by email (if accepted by user).**
But I am not able to get any mail :( !
As far i know, the mailTo option needs the user in order to send the email.
When an error occurs another mail client (such as Gmail.apk) has to be open to process the crash report and send e-mail. So the error will open a mail client and we need the user to click on send button.
Although a bit late, someone might find it useful anyways...
I did have at least a similar problem with ACRA 4.5.0 which I was able to resolve once all the other configuration options were actually set. This means – although partially labeled as optional – I had to give a value to the following options (in the #ReportsCrashes annotation)
resDialogText = R.string.crash_dialog_text, // Text to display upon crash
resDialogIcon = android.R.drawable.ic_dialog_info, //optional (apparently not). default is a warning sign
resDialogTitle = R.string.crash_dialog_title, // optional (apparently not). default is your application name
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt, // optional (apparently not). when defined, adds a user text field input with this text resource as a label
resDialogOkToast = R.string.crash_dialog_ok_toast // optional (apparently not). displays a Toast message when the user accepts to send a report.
Though I had mode = ReportingInteractionMode.DIALOG, set which might be the source of my problems at least.
have not used "mailTo" field ,had only used #ReportsCrashes(formKey = "formkey")
Make sure you get the form key from google drive correctly
And on crash you will be getting the report on Google drive excel file
And also make sure you have added Internet permission and Added "MyApplication" in mainfeast
<manifest ...>
<application ... android:name="MyApplication">
...
</application>
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
</manifest>
Detail explanation is provided here http://acra.ch/
My acra bug reports show up in BugSense with a field "Android ID".
I tested this, and it remains constant between application installations. we do not want to send any information that can be used to track the user. Is there a way to avoid sending such data?
I'm not customizing the report data at all, so it's all defaults. I do not grant the READ_PHONE_STATE permission, so I'd expect that would prevent "Android ID" from being sent to BugSense.
any ideas?
You could try customReportContent, per https://github.com/ACRA/acra/wiki/AdvancedUsage#wiki-Choosing_which_fields_to_be_included_in_reports. According to the docs, "Only fields which are set in customReportContent are actually processed".
From their sample code:
#ReportsCrashes(formKey = "xxxxxxxxxxxxxxxx",
customReportContent = { APP_VERSION, ANDROID_VERSION, PHONE_MODEL, CUSTOM_DATA, STACK_TRACE, LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
Enable/disable including DeviceID #
If you added the READ_PHONE_STATE permission to your application but want to let your user be able to disable the inclusion of their Device ID in crash reports, you can include the following CheckBoxPreference:
<CheckBoxPreference android:key="acra.deviceid.enable"
android:title="#string/pref_acra_deviceid"
android:summaryOn="#string/pref_acra_deviceid_enabled"
android:summaryOff="#string/pref_acra_deviceid_disabled"
android:defaultValue="true"/>
Don't forget to add the required strings in your strings.xml files.
https://github.com/ACRA/acra/wiki/AdvancedUsage#wiki-Enable/disable_including_DeviceID
I am using ACRA for android app like this
#ReportsCrashes(formKey = "dEpU12345lRZYjFtOUxMVHl4MFpMdnc6MQ", mailTo = "issues#xyz.com",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
it is perfectly sending crash report along with Log cat. It is sending all last 200 lines of logcat with date by default.But I want to customize it to send only last 100 log cat messages of my app with log levels i or d. How to do it.
By following below link
https://github.com/ACRA/acra/wiki/AdvancedUsage#adding-logcat-eventlog-or-radiolog-extracts-to-reports
I made changes like this
#ReportsCrashes(formKey = "dEpU12345lRZYjFtOUxMVHl4MFpMdnc6MQ", mailTo = "issues#xyz.com",
customReportContent = { ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL, ReportField.CUSTOM_DATA, ReportField.STACK_TRACE, ReportField.LOGCAT },
logcatArguments = { "-t", "100", "-v", "long","test:I" ,"*:D","*:S"},
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
even though I printed some log messages with tag "test" and level "i", and manged them to print before my known crash in my app, I am getting empty logcat. I want log messages of only my app with level i or d with ACRA, how to achieve this. Thanks In Advance.
The below works for me for D level logging. My proguard strips V and I levels for production deployemnts. I am using the following code to update the log
Log.d("YOUR_TAG_HERE", "Some message here");
and the ACRA configuration is
logcatArguments = { "-t", "200", "-v", "long", "ActivityManager:I", "YOUR_TAG_HERE:D", "*:S" }
and don't forget to update your AndroidManifest.xml file adding the necessary permissions
<uses-permission android:name="android.permission.READ_LOGS" />
I was having troubles with my library project and my READ_LOGS permission was missing. I was getting random results until I added the READ_LOGS permission to the final project (not the library project).
In my project I used navigator.notification.activitystart("Title","Message").
But it is just showing the title as "Busy" and message as "Please wait". I can stop the activity with navigator.notification.activityStop()
So i want to ask does the activityStart really shows the title and message on android phones.
I am using phonegap1.1.0
Thanks all in advance
From both phonegap-1.1.0.js and phonegap-1.3.0.js:
Notification.prototype.activityStart = function() {
PhoneGap.exec(null, null, "Notification", "activityStart", ["Busy","Please wait..."]);
};
Note that activityStart takes no parameters, so you'd have to modify it to actually accept your parameters.