Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.85 KB | None | 0 0
  1. package prospect.firmname.net.prospect;
  2. import android.app.Application;
  3. import android.content.Context;
  4.  
  5. import org.acra.*;
  6. import org.acra.annotation.*;
  7. import org.acra.sender.HttpSender;
  8.  
  9. import static org.acra.ACRA.log;
  10.  
  11. @ReportsCrashes(
  12. formUri = "http://prospect.firmname.net/report.php",
  13. reportType = HttpSender.Type.JSON,
  14. httpMethod = HttpSender.Method.POST,
  15. customReportContent = {
  16. ReportField.APP_VERSION_CODE,
  17. ReportField.APP_VERSION_NAME,
  18. ReportField.ANDROID_VERSION,
  19. ReportField.PACKAGE_NAME,
  20. ReportField.REPORT_ID,
  21. ReportField.BUILD,
  22. ReportField.STACK_TRACE
  23. },
  24. mode = ReportingInteractionMode.TOAST
  25. )
  26. public class ProspectApplication extends Application {
  27. @Override
  28. public void onCreate() {
  29. super.onCreate();
  30. log.e("ACRA BOOTING","OK");
  31. ACRA.init(this);
  32. }
  33. @Override
  34. protected void attachBaseContext(Context base) {
  35. super.attachBaseContext(base);
  36. ACRA.init(this);
  37. }
  38. }
  39.  
  40. <application
  41. android:allowBackup="true"
  42. android:icon="@mipmap/ic_launcher"
  43. android:label="@string/app_name"
  44. android:supportsRtl="true"
  45. android:name="ProspectApplication"
  46. android:theme="@style/AppTheme">
  47. ~~~~
  48. </application>
  49.  
  50. apply plugin: 'com.android.application'
  51.  
  52. android {
  53. compileSdkVersion 24
  54. buildToolsVersion "25.0.0"
  55. defaultConfig {
  56. applicationId "prospect.firmname.net.prospect"
  57. minSdkVersion 14
  58. targetSdkVersion 19
  59. versionCode 1
  60. versionName "1.0"
  61. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  62. }
  63. buildTypes {
  64. release {
  65. minifyEnabled false
  66. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  67. }
  68. }
  69. }
  70.  
  71. dependencies {
  72. compile fileTree(dir: 'libs', include: ['*.jar'])
  73. androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
  74. exclude group: 'com.android.support', module: 'support-annotations'
  75. })
  76. compile 'com.android.support:appcompat-v7:24.2.1'
  77. compile 'com.googlecode.json-simple:json-simple:1.1'
  78. compile 'ch.acra:acra:4.9.2'
  79. testCompile 'junit:junit:4.12'
  80. }
  81.  
  82. android {
  83. useLibrary 'org.apache.http.legacy'
  84. }
  85.  
  86. report.php
  87. <?php
  88. // Outputs all POST parameters to a text file. The file name is the date_time of the report reception
  89. error_log("_REQUEST called " . print_r($_REQUEST,true),0);
  90. $fileName = 'acra/'.date('Y-m-d_H-i-s').'.txt';
  91. $file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
  92. foreach($_POST as $key => $value) {
  93. $reportLine = $key." = ".$value."n";
  94. fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
  95. }
  96. fclose($file);
  97. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement