Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
/ acra-php-mailer Public archive

PHP based server side component for ACRA (crash reporting library for Android apps) which forwards all incoming crash reports to a defined mail address.

License

Notifications You must be signed in to change notification settings

dnsknr/acra-php-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

acra-php-mailer

Simple PHP based server side component for ACRA (crash reporting library for Android apps) which forwards all incoming crash reports to a defined mail address. The stack trace is additionally attached as an TXT file to allow easier retracing of ProGuard obfuscated source code.

Prerequsites

  • A web server with PHP support
  • ACRA added to your Android app

Setup

ACRA PHP Mailer

  1. Edit the configuration at the top of the acra.php file. Set appropriate mail addresses there.
// Configuration
$to = '[email protected]';
$from = '[email protected]';
  1. Upload the acra.php file to your PHP supporting web server.

To prevent unauthorized access to the acra.php file you should password protect it, e.g. by using a .htaccess file if supported by your web server.

  1. Edit the .htpasswd file and replace the username/password combination with your secret credentials. The username/password combination can be generated e.g. on this website. You can also re-use an existing .htpasswd file if available.
  2. Upload the .htpasswd file to your web server.

WARNING: For security reasons you should never upload a .htpasswd file to a folder accessible from the Internet!

  1. Edit the .htaccess file and set the correct path to the .htpasswd file above.
AuthUserFile /path/to/your/.htpasswd
  1. Upload the .htaccess file to the same folder as the acra.php file.

ACRA (Quick Start)

The full documentation of ACRA is available on www.acra.ch, the following section is just a quick start to use ACRA together with the ACRA PHP Mailer.

  1. Add ACRA as dependency to your app module Gradle file:
dependencies {
    ... your other dependencies...
    compile "ch.acra:acra:4.7.0"
}
  1. Create or update an Application subclass and add ACRA to it:
@ReportsCrashes(
    formUri = "http://www.your.url/acra.php",
    formUriBasicAuthLogin = "your username", // optional
    formUriBasicAuthPassword = "your password",  // optional
    reportType = org.acra.sender.HttpSender.Type.JSON,
    sendReportsAtShutdown = false
)
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        ACRA.init(this);
        super.onCreate();
    }
}
  1. Reference the new Application class in your Android Manifest:
<application
    android:name=".MyApplication"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name">
    [...]
  1. Obviously, your app will need the INTERNET permission:
<uses-permission android:name="android.permission.INTERNET"/>
  1. Update your ProGuard file to keep ACRA classes, all details can be found here:
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-keep class org.acra.** { *; }
  1. Done, from now on you should receive a mail every time your app crashes!

About

PHP based server side component for ACRA (crash reporting library for Android apps) which forwards all incoming crash reports to a defined mail address.

Resources

License

Stars

Watchers

Forks

Packages

No packages published