how to send report to Acralyzer manual - android

I am using Acralyzer for reporting of errors (Crash reports)
Now I want to manually send a Custom report to Acra.
But do not know , how to do ?

Try this:
try
{
// some code
}
catch (Exception e) {
ErrorReporter.getInstance().handleException(e);
}

Related

Ktor: delete temporary file after response is sent

I'm sending a temporary file as a response to a request using the ktor library on a android tablet, but I can't find a way to safe delete it after being sent (or something went wrong).
How can I make sure that this file was delete without interrupting the sending process? Maybe using some callback or method that I´m not aware of.
Update: answering comments:
my code:
try {
call.response.headers.append("entity-count", entityCount)
call.response.headers.append("sync-length", lenght)
call.respondFile(FileContent(file) // need to delete this file after sent OR failed
} catch (e: Exception) {
Log.e(TAG, e)
}
should I just add a file.delete() line inside a finally block?
I think my main question/confusion (coming from java world) its if respondFile is a blocking call or not. If it its, just adding file.delete on finally block will be fine, otherwise I need to register somme kind of onCompleted callback.
You can use finally: it will be called after sending the file or in case of an error
try {
call.response.headers.append("entity-count", entityCount)
call.response.headers.append("sync-length", lenght)
call.respondFile(FileContent(file) // need to delete this file after sent OR failed
} catch (e: Exception) {
Log.e(TAG, e)
} finally {
file.delete()
}

LogCat View trouble on AIDE -IDE Android

after I run any application on my phone, using free version of AIDE -IDE Android, everytime I view LogCat, I get the same message : " run the app to see the log output ".!
Here is the following screenshot :(https://i.stack.imgur.com/uLORU.png)
Is LogCat free on AIDE-IDE Google play app ?
Thank you for your attention.
It's free as far as i know, but you need root access in order for log to work.
Besides: it doesn't work from time to time with root either.
Another option: use following function to log to local file:
public void appendLog(String text)
// https://stackoverflow.com/a/6209739
{
File logFile = new File("sdcard/log.file");
if (!logFile.exists())
{
try
{
logFile.createNewFile();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try
{
//BufferedWriter for performance, true to set append to file flag
BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
buf.append(text);
buf.newLine();
buf.flush();
buf.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Use it like this:
try{
// your code goes here
}catch (Exception e){
appendLog(e.getMessage());
}
You need to add permission for writing_external_storage in Manifest.
There is no problem with your code. However the problem is with AIDE version your using. Am using the Pro and Logcat is working fine for me
I found this way, as shown below, using Log.getStackTraceString(Exception e), to solve my LogCat View trouble on AIDE-IDE Android. The only remaining question is why there is no display of Log.e (TAG,"Exception ",e) ?
Thank you for your attention.
Code of MainActivity (https://i.stack.imgur.com/Dqfc5.png)

Parse.com - Logging Caught Exceptions

Can we send caught errors to Parse.com bugs dashboard like this example from Crashlytics
try {
myMethodThatThrows();
} catch (Exception e) {
Crashlytics.logException(e);
// handle your exception here!
}
Are you looking for Parse Crash Reporting?

Android WAP_PUSH_RECEIVED Parse

I've made a simple BroadcastReceiver to catch the MMS before the native app. Now I want to parse the data of this MMS in order to do some work on it.
In my onReceive method, I've the following code:
if (intent.getAction().equals(MMS_RECEIVED) && intent.getType().equals("application/vnd.wap.mms-message"))
{
Log.e(">>>>>", "MMS");
try
{
byte[] pushData = intent.getByteArrayExtra("pdu");
// What to do with that ?
}
catch (Exception e)
{
e.printStackTrace();
}
// TODO Send notification
}
How can I retrieve the MMS data and download the associated part ?
This may be useful. The was mms is handled is quite different to SMS and the below link is similar to what I do: https://github.com/romannurik/dashclock/blob/master/main/src/main/java/com/google/android/apps/dashclock/phone/SmsExtension.java

How to catch Amazon AWS errors Android

I am constantly getting error reports (from users) such as:
Caused by: Status Code: 400, AWS Service: AmazonSimpleDB, AWS Request ID: c5cb109d-bbff-fcea-bc0d-0cb60ff8f6af, AWS Error Code: RequestExpired, AWS Error Message: Request has expired. Timestamp date is 2012-06-06T13:19:59.415Z. Current date is 2012-06-06T14:20:03Z
Apparently this is because the user has the wrong timezone or something set? Regardless, I would like to catch this particular error and post a message to the user asking them to check their timezone settings however I can't find a way to do it. If I catch AmazonServiceException, the error shows up as null.
How can I catch errors based on Status Code or even Error Code? The current code that I tried looks like this:
try {
dostuff()
} catch (IOException e) {
updateAWS("DownloadErrors");
return "filenotfound";
} catch (AmazonServiceException e) {
return "downloadfail";
}
However AmazonServiceException e is always null so I can't pull any information from it.
other code:
private void doStuff() throws IOException, AmazonServiceException{
//code here
}
Apparently this is what I needed. SDb tracks "RequestExpired" and S3 uses "RequestTimeTooSkewed"
Also, this appears to be occurring because the system time is >15 minutes different than the AWS server. I put a note to the user to check their time and use "Automatic" date/time if possible. Tested it myself and reproduced the error as well as the solution.
try {
result = doOperations();
} catch (AmazonServiceException e) {
if (e.getErrorCode().equals("RequestExpired") || e.getErrorCode().equals("RequestTimeTooSkewed")) {
result = "timestamp";
}
}
return result;
}

Categories

Resources