Using ACRA with tracepot as backend - android

I have just finished my first android app as part of a school project ..one of my friends encountered a problem while trying to explore one of the activities in the app ..so i searched for solutions to get the crashes reports whenever they happen to fix the bugs ..i came across ACRA ..and I followed one of SO threads to setup ACRA to my app ..
RESULT: when the crashs happens the gmail app get launch in the device and the user (if he want to) he'll send the crash report by email ..Consedering not all users will want to ..i found in a comment in one of the SO threads that some developers use tracepot.
so i have used their link for integration in formUri but exploring my account on tracepot i get nothing ..is there something i am doing wrong (or if there is a better solution than using tracepot a backend , please suggest/explain or link a good tutorial, thanks!)
MyApplication.Java ( AFTER EDITING
#ReportsCrashes(
formUri = "https://collector.tracepot.com/79b1***",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text
)
public class MyApplication extends Application {
#Override
public void onCreate() {
super.onCreate();
CaocConfig.Builder.create()
//.errorActivity(CustomErrorActivity.class) //default: null (default error activity)
.apply();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
EDIT :
msg in logcat if i use the http and email:
09-17 18:37:33.700 14329-14812/ma.ac.iav.menunaviagtion:acra W/ACRA: ma.ac.iav.menunaviagtion reports will be sent by email (if accepted by user).
09-17 18:37:33.703 14329-14812/ma.ac.iav.menunaviagtion:acra I/ACRA: Sending report /data/user/0/ma.ac.iav.menunaviagtion/app_ACRA-approved/2018-09-17T18:37:33.441+01:00-IS_SILENT.stacktrace
if i use only the http :
09-17 22:47:00.648 20116-20137/ma.ac.iav.myapplication:acra E/ACRA: Failed to send crash report for /data/user/0/ma.ac.iav.myapplication/app_ACRA-approved/2018-09-17T22:44:52.199+00:00-IS_SILENT.stacktrace
IMPLEMENTATION:
compile 'ch.acra:acra:4.9.2'
LOGCAT FOR F43nd1r
09-18 01:39:49.631 18508-18803/? E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: ma.ac.iav.myapplication, PID: 18508
java.lang.InternalError: Thread starting during runtime shutdown
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:733)
at android.app.SharedPreferencesImpl.startLoadFromDisk(SharedPreferencesImpl.java:119)
at android.app.SharedPreferencesImpl.<init>(SharedPreferencesImpl.java:112)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:392)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:373)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.getLastCrashTimestamp(CustomActivityOnCrash.java:673)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.hasCrashedInTheLastSeconds(CustomActivityOnCrash.java:683)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash.access$200(CustomActivityOnCrash.java:52)
at cat.ereza.customactivityoncrash.CustomActivityOnCrash$1.uncaughtException(CustomActivityOnCrash.java:112)
at org.acra.builder.ReportExecutor.endApplication(ReportExecutor.java:269)
at org.acra.builder.ReportExecutor.dialogAndEnd(ReportExecutor.java:254)
at org.acra.builder.ReportExecutor.access$400(ReportExecutor.java:42)
at org.acra.builder.ReportExecutor$2.run(ReportExecutor.java:217)

By default, if the mail config is present, Acra 4 will send via mail and nothing else.
To use both you'd have to configure the reportSenderFactories.
400: Client error
Indicates that tracepot rejected your report. This could have multiple reasons. To find out what the problem is, call ACRA.DEV_LOGGING = true; right before ACRA.init and post all logcat with the ACRA tag.
Also note that ACRA 4.9.2 does not support android Oreo and above, it is recommended to upgrade to at least ACRA 4.11, or just the newest version 5.2.0.

You are not sending all required fields to Tracepot.
https://tracepot.uservoice.com/knowledgebase/articles/355272-what-are-the-required-fields-acra-needs-to-send
ANDROID_VERSION
APP_VERSION_CODE
APP_VERSION_NAME
PACKAGE_NAME
REPORT_ID
STACK_TRACE
USER_APP_START_DATE
USER_CRASH_DATE

Related

Error while running PJSUA android sample application

I am trying to build & run pjsua sample app of pjsip and have successfully build it.
I have followed this PJSIP tutorial.
ID : sip:150#123.12.xxx.123:5060
Registrar : sip:123.12.xxx.123:5060
Proxy : sip:123.12.xxx.123:5060
Username : 150
Password : 111111
I am able to register as i am getting "Registration Successful" as response on dialog screen and 200 ok response in log.
I added a buddy with URI as sip:151 (username). It is being shown in list.
When i select buddy from list and try to make call i get a crash with following error log.
10-24 10:57:13.644: A/libc(7553): ../src/pjmedia/sdp_neg.c:110: pjmedia_sdp_neg_create_w_local_offer: assertion "(status=pjmedia_sdp_validate(local))==PJ_SUCCESS" failed
10-24 10:57:13.644: A/libc(7553): Fatal signal 6 (SIGABRT), code -6 in tid 7699 (Thread-21990)
I am not sure where i am going wrong but i am not able to establish a sip call with my sip server.
I have tested my server with CSipSimple app available from this link and it is working fine with it.
Thanks in advance.
Just a theory, but maybe try adding him using the URI of "sip:151#YourServer"
Same crash and lot of search bring me to this post.
I'm build pjsip without video codecs and size of CodecInfoVector was 0.
CodecInfoVector mCodecInfoVectorV = mEndpoint.videoCodecEnum();
for (int i = 0; i < mCodecInfoVectorV.size(); i++) {
System.out.println(mCodecInfoVectorV.get(i).getCodecId() + "\n" +
mCodecInfoVectorV.get(i).getDesc());
}
So i had to enable video codecs and re-build pjsip even if they are isn't used. And after that i've been able to make call

Access scope using Kind Name on Google Cloud / Android Mobile Backend Starter

Documentation for the Google Cloud MBS states that access to stored Entities can be controlled via prefixing the KindName of that entity with strings "[public]" or "[private]" (or nothing).
https://cloud.google.com/developers/articles/mobile-backend-starter-api-reference#acfce
However attempting insertion of CloudEntities into the Datastore using KindNames that start with [public] or [private] causes an exception/error, specifically that the KindName is invalid.
This is the case both for the Backend running in Open and in Secured mode (using Google login credentials to derive the _owner field)
e.g. here I use KindName "[public]TestDB" which fails, whereas "TestDB" would not throw any exception.
04-22 19:57:54.132: E/AndroidRuntime(4690): Process: com.example.package, PID: 4690
04-22 19:57:54.132: E/AndroidRuntime(4690): java.lang.IllegalArgumentException: Illegal kind name: [public]TestDB
04-22 19:57:54.132: E/AndroidRuntime(4690): at com.google.cloud.backend.core.CloudEntity.(CloudEntity.java:86)
04-22 19:57:54.132: E/AndroidRuntime(4690): at com.example.package.CloudUtil.convertUpdatesToCEList(CloudUtil.java:252)
04-22 19:57:54.132: E/AndroidRuntime(4690): at com.example.package.CloudUtil.checkSync(CloudUtil.java:199)
The relevant section of code editted/compressed for brevity is:
CloudBackendMessaging cbm=_cloudfrag.getCloudBackend();
List<CloudEntity> entries=new ArrayList<CloudEntity>();
while (...) {
CloudEntity ce=new CloudEntity(_CLOUD_DB_KIND);
ce.put("fieldname", devID);
entries.add(ce);
}
_countActivity.runOnUiThread(new Runnable() {
#Override
public void run() {
cbm.updateAll(entries, handler);
}
});
Where handler is the callback and _cloudfrag is the CloudBackendFragment from the sample code.
I get the same effect using both inserts and updates, for single or multiple i.e. lists of entities at a time.
I can only think I'm misunderstanding the documentation - but it seems fairly explicit that KindNames can begin with [public] [private] etc?
Judging by the bug reports on github from others experiencing the same issue, this is a bug in Google's MBS library.
Unfortunately the response to this has been silence for months until tonight the devs posted a single commit updating the readme file to indicate this library is no longer supported and is not an official google product (despite it being pushed as a starter kit with every cloud project started from the console!).
https://github.com/GoogleCloudPlatform/solutions-mobile-backend-starter-android-client/pull/16
Looking at the source I think this access modifier feature was never actually implemented despite documentation to the contrary.

Verify that ACRA is working

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

How to send a SMS through a Phone Gap application for the basic version?

I have tried implementing 3 different plug-in's for this in cordova-2.1.0
But nothing has worked out..
Plugin No: 1
source: here
error faced: full plugin file rather the java file had errors and had asked to create field names such as cordova call back content...etc
Plugin No: 2
source:here
error faced: no responsei am able to enter the phone no and message..i am supposed to get an alert with the number and message but did not get it.could not decode
Plugin No: 3
source:here
error faced: while i called just this in the sms function**
sendSMS.send(‘Mobile Number’, ‘Text’, ‘Call back function on complete’);
i got an error of
05-31 15:03:05.879: E/Web Console(15239): Uncaught ReferenceError: sendSMS is not defined at file:///android_asset/www/index.html:14.
when i gave this
var sendSMS = {
send : function(phone, message, successCallback, failureCallback) {
return cordova.exec(successCallback, failureCallback, 'SmsPlugin',"SendSMS", [ phone, message ]);
}
};
if (!window.Cordova) {
window.Cordova = cordova;
};
sendSMS.send('Mobile Number', 'Text', 'Call back function on complete');
i got a toast message as generic failure and then in the logcat as
05-31 15:04:23.082: E/ActivityThread(15400): Activity com.phone.gap.fist proj.MainActivity has leaked IntentReceiver com.phonegap.plugins.sms.SmsPlugin$2#414f1068 that was originally registered here. Are you missing a call to unregisterReceiver()?
Use the social plugin a common one for SMS,E-MAIL and opening all the social network applications available on your device.
here
Its simple to implement.

ACRA : Configured to send report on mail but not getting any mail

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/

Categories

Resources