2

I'm trying to use ARCA as a bug reporter in my Qt-Android project. I read this tutorial and I added .JAR file to my project , created new class (ReportApp.java) in my project.

ReportApp.java:

package org.qtproject.example.myApplication;
import org.acra.*;
import org.acra.annotation.*;
import android.app.Application;

@ReportsCrashes(
    formUri = "http://********/report/reportpath.php",
    formUriBasicAuthLogin = "root",
    formUriBasicAuthPassword = "***************",
    mode = ReportingInteractionMode.TOAST,
    forceCloseDialogAfterToast = false, // optional, default false
    resToastText = R.string.crash_toast_text)
public class ReportApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ACRA.init(this);
    }
}

Edited this line in AndroidManifest.xml:

instead of using

<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/icon">

I use :

<application android:hardwareAccelerated="true" android:name="org.qtproject.example.myApplication.ReportApp" android:label="@string/app_name" android:icon="@drawable/icon">

And add this line to Strings.xml:

<string name="crash_toast_text">Ooooops ! I crashed, but a report has been sent to my developer to help fix the issue !</string>

Actually , there is no toast message when myApplication is crash and it not send any message to my server. Here is my script:

reportpath.php:

<?php    
    $fileName = date('Y-m-d_H-i-s').'.txt';
    $file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
    foreach($_POST as $key => $value) {
      $reportLine = $key." = ".$value."\n";
      fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
    }
    fclose($file);
?>

Is there any suggestion?

EDITED: I've tested another way in ReportApp.java:

ReportApp.java:

use

public class ReportApp extends org.qtproject.qt5.android.bindings.QtApplication 

instead of

public class ReportApp extends Application

But also it doesn't work.

Farzan Najipour
  • 2,442
  • 7
  • 42
  • 81

0 Answers0