Android Crash report using ACRA ,BugSense and Parse.com
In my previous post I have described how to integrate ACRA and goolge form in order to get crash reports from Android application. Google as published new version of their form so it can no longer be used as ACRA report storage (more details can be found here). If you want to use ACRA and do not have your own server you need to choose other backends.I will present two options:
1. Using BugSense.
2. Using Parse.com.
Using BugSense
BugSense provide tools for monitor your mobile application. BugSense has crash report similar to ACRA but BugSense web server can also get ACRA reports without the need to download or use additional SDKs.
In order to integrate ACRA abd BugSense:
1. Open account in BugSense.
2. Define your application in BugSense dashboard
3. Create Android application class and add it to your project Manifest file.
2. Define your application in BugSense dashboard
3. Create Android application class and add it to your project Manifest file.
@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=YOUR_API_KEY", formKey="")
public class MyApp extends Application
{
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
ACRA.init(this);
}
Using Parse.com
Parse provides backend services for mobile and web application it also has push notifications services. It free addition provide about 1M requests per month. I will use Parse in order to store ACRA crash reports.
Integrating Parse and ACRA:
1. Register to Parse and download the SDK.
2. Create application in Parse website and get the application,client keys.
2. Create application in Parse website and get the application,client keys.
3. Add the SDK to you application Lib directory and add it to build path.
4. Verify that you have the following permissions in you Manifest file
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
5. You need to get Application key and Client key for your application (look at Parse application dashboard settings)
6. Create Android application class and add it to your project Manifest file.
7. Initialize parse sdk, ACRA and register report sender in the application class onCreate method.
import org.acra.ACRA;
import org.acra.ErrorReporter;
import org.acra.annotation.ReportsCrashes;
import android.app.Application;
import com.parse.Parse;
import com.parse.ParseObject;
@ReportsCrashes( formKey="")
public class MyApp extends Application
{
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
Parse.initialize(this, Application key,Client key);
ACRA.init(this);
ErrorReporter.getInstance().setReportSender(new LocalSender(this));
}
}
7. The following code implements ACRA report sender that will send the crash report file to Parse.com. The code uses ParseFile and ParseObject (details).
import java.io.ByteArrayOutputStream;
public class LocalSender implements ReportSender {
private final Map<ReportField, String> mMapping = new HashMap<ReportField, String>() ;
private FileOutputStream crashReport = null;
private Context ctx;
public LocalSender(Context ct) {
ctx = ct;
}
public void send(CrashReportData report) throws ReportSenderException {
final Map<String, String> finalReport = remap(report);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
Log.i("hcsh","Report send");
try {
Set set = finalReport.entrySet();
Iterator i = set.iterator();
String tmp;
while (i.hasNext()) {
Map.Entry<String,String> me = (Map.Entry) i.next();
tmp = "[" + me.getKey() + "]=" + me.getValue();
buf.write(tmp.getBytes());
}
ParseFile myFile = new ParseFile("crash.txt", buf.toByteArray());
myFile.save();
ParseObject jobApplication = new ParseObject("AppCrash");
jobApplication.put("MyCrash", "Test App");
jobApplication.put("applicantResumeFile", myFile);
try {
jobApplication.save();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch (FileNotFoundException e) {
Log.e("TAG", "IO ERROR",e);
}
catch (IOException e) {
Log.e("TAG", "IO ERROR",e);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private Map<String, String> remap(Map<ReportField, String> report) {
ReportField[] fields = ACRA.getConfig().customReportContent();
if (fields.length == 0) {
fields = ACRA.DEFAULT_REPORT_FIELDS;
}
final Map<String, String> finalReport = new HashMap<String, String>(
report.size());
for (ReportField field : fields) {
if (mMapping == null || mMapping.get(field) == null) {
finalReport.put(field.toString(), report.get(field));
} else {
finalReport.put(mMapping.get(field), report.get(field));
}
}
return finalReport;
}
}
8. In case of crash the result on Parse dashboard will be :
Each crash will be display in separate row with report time stamp.
parse features measures the actual usage of the app: it minutely views your app and API request data through the Parse dashboard. The developer can see real-time analytics on API requests based dashboard on REST verbs, device type, and Parse class being accessed.
ReplyDeleteBecause Parse shutdown I've migrated my application to www.back4app.com Can someone detail me how to proceed regarding the push notifications?
ReplyDeleteThis is really very interesting. This blog contain too much information about parse android app development.
ReplyDeleteThank you for posting this beneficial content material. You provided another one great article in robotics projects chennai. I hope this information may change my business carrier.I can remember these things whenever taking the decision in raspberry pi projects chnenai.
ReplyDeleteYour good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteData Science Training in Chennai
Data science training in bangalore
Data science online training
Data science training in pune
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteDevops training in Chennai
Devops training in Bangalore
Devops Online training
Devops training in Pune
Thanks for sharing this valuable information to our vision Digital Marketing Courses in Mumbai
ReplyDeleteInspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
ReplyDeletejava training in annanagar | java training in chennai
java training in marathahalli | java training in btm layout
java training in rajaji nagar | java training in jayanagar
java training in chennai
I think this is a great site to post and I have read most of contents and I found it useful for my Career .Thanks for the useful information. For any information or Queries Comment like and share it.
ReplyDeletePMP Training Abu Dhabi
GDPR Training in Hyderabad
GDPR Training in Pune
This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
ReplyDeletepython training in velachery
python training institute in chennai
Thanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
ReplyDeleteDevOps online Training
Best Devops Training institute in Chennai
Hello. This post couldn’t be written any better! Reading this post reminds me of my previous roommate.
ReplyDeletenebosh course in chennai
This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
ReplyDeleteangularjs online Training
angularjs Training in marathahalli
angularjs interview questions and answers
angularjs Training in bangalore
angularjs Training in bangalore
angularjs online Training
Thanks for sharing this pretty post, it was good and helpful. Share more like this.
ReplyDeleteccna course in Chennai
ccna Training institute in Chennai
Best CCNA Training Institute in Chennai
ccna certification in Chennai
ccna Training in Velachery
ccna Training in Chennai
Great Blog!
ReplyDeleteJava Training in Chennai
Python Training in Chennai
IOT Training in Chennai
Selenium Training in Chennai
Data Science Training in Chennai
FSD Training in Chennai
MEAN Stack Training in Chennai
Awesome
ReplyDeletejava training in Marathahalli
spring training in Marathahalli
java training institute in Marathahalli
spring and hibernate training in Marathahalli
Very impressive thanks for sharing
ReplyDeleteCCNA training class in chennai
Howdy, would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers, and I must say this blog loads a lot quicker than most. Can you suggest a good internet hosting provider at a reasonable price?
ReplyDeleteiosh course in chennai
Thanks for providing such helpful information. I will definitely follow this steps while developing android applications.
ReplyDeleteI am curious to find out what blog system you’re using?
ReplyDeleteapple iphone service center in chennai | apple ipad service center in chennai | apple iphone service center in chennai
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
ReplyDeleteDevops Training in Electronic City
I read your blog , this is very attractive and impressive blog .
ReplyDeleteexcellent casino poker guru
ReplyDeleteexcellent posted by bombaybasera
ReplyDeletegreat post
ReplyDeletebetfair api support
Great post! I am actually getting ready to across this information, It’s very helpful for this blog. Also great with all of the valuable information you have Keep up the good work you are doing well.
ReplyDeleteData Science Training In Chennai | Certification | Data Science Courses in Chennai | Data Science Training In Bangalore | Certification | Data Science Courses in Bangalore | Data Science Training In Hyderabad | Certification | Data Science Courses in hyderabad | Data Science Training In Coimbatore | Certification | Data Science Courses in Coimbatore | Data Science Training | Certification | Data Science Online Training Course
I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.
ReplyDelete
ReplyDeleteNice article and thanks for sharing with us. Its very informative
Tableau Training in Hyderabad
Excellent content! Thanks for sharing such a useful information.
ReplyDeleteBig Data Training Institute In Bangalore
Big Data Training In Bangalore
I surely acquiring more difficulties from each surprisingly more little bit of it
ReplyDeletedata scientist training and placement
I really enjoyed reading this post, big fan. Keep up the good work and please tell me when can you publish more articles or where can I read more on the subject?
ReplyDeletedata science institutes in hyderabad
Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one.
ReplyDeletedata analytics course in hyderabad
Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing.business analytics course in rohtak
ReplyDeleteçekmeköy vestel klima servisi
ReplyDeleteataşehir vestel klima servisi
kartal vestel klima servisi
kartal bosch klima servisi
ümraniye bosch klima servisi
kartal arçelik klima servisi
ümraniye arçelik klima servisi
beykoz samsung klima servisi
üsküdar samsung klima servisi
Your blog has a lot of intriguing content, especially the discussions. I assume that not just myself is finding this place to be quite enjoyable based on the numerous comments on your posts. Continue your wonderful work. Click here to Enroll in data science Training in Bhopal
ReplyDelete