Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package prospect.firmname.net.prospect;
- import android.app.Application;
- import android.content.Context;
- import org.acra.*;
- import org.acra.annotation.*;
- import org.acra.sender.HttpSender;
- import static org.acra.ACRA.log;
- @ReportsCrashes(
- formUri = "http://prospect.firmname.net/report.php",
- reportType = HttpSender.Type.JSON,
- httpMethod = HttpSender.Method.POST,
- customReportContent = {
- ReportField.APP_VERSION_CODE,
- ReportField.APP_VERSION_NAME,
- ReportField.ANDROID_VERSION,
- ReportField.PACKAGE_NAME,
- ReportField.REPORT_ID,
- ReportField.BUILD,
- ReportField.STACK_TRACE
- },
- mode = ReportingInteractionMode.TOAST
- )
- public class ProspectApplication extends Application {
- @Override
- public void onCreate() {
- super.onCreate();
- log.e("ACRA BOOTING","OK");
- ACRA.init(this);
- }
- @Override
- protected void attachBaseContext(Context base) {
- super.attachBaseContext(base);
- ACRA.init(this);
- }
- }
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:supportsRtl="true"
- android:name="ProspectApplication"
- android:theme="@style/AppTheme">
- ~~~~
- </application>
- apply plugin: 'com.android.application'
- android {
- compileSdkVersion 24
- buildToolsVersion "25.0.0"
- defaultConfig {
- applicationId "prospect.firmname.net.prospect"
- minSdkVersion 14
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- }
- dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:appcompat-v7:24.2.1'
- compile 'com.googlecode.json-simple:json-simple:1.1'
- compile 'ch.acra:acra:4.9.2'
- testCompile 'junit:junit:4.12'
- }
- android {
- useLibrary 'org.apache.http.legacy'
- }
- report.php
- <?php
- // Outputs all POST parameters to a text file. The file name is the date_time of the report reception
- error_log("_REQUEST called " . print_r($_REQUEST,true),0);
- $fileName = 'acra/'.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);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement