From 691e94f7a304c5309374a4bb2e08507473287a7a Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Sun, 12 Feb 2012 20:14:12 +0400 Subject: [PATCH] remote stack traces --- AndroidManifest.xml | 2 +- project.properties | 2 +- .../android/calculator/CalculatorActivity.java | 2 ++ .../calculator/CalculatorApplication.java | 6 ++++++ .../billing/CalculatorBillingService.java | 17 +++++++++++++++++ 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e3e96c1c..f0ceeaad 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -101,7 +101,7 @@ - + diff --git a/project.properties b/project.properties index 8da376af..ea89160e 100644 --- a/project.properties +++ b/project.properties @@ -8,4 +8,4 @@ # project structure. # Project target. -target=android-15 +target=android-8 diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java index 267da17e..032c2f4a 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorActivity.java @@ -176,6 +176,8 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh @Override public void onCreate(@Nullable Bundle savedInstanceState) { + CalculatorApplication.registerOnRemoteStackTrace(); + final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); diff --git a/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java b/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java index a4186cd0..f12dc33f 100644 --- a/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java +++ b/src/main/java/org/solovyev/android/calculator/CalculatorApplication.java @@ -14,6 +14,7 @@ import net.robotmedia.billing.BillingController; import org.jetbrains.annotations.NotNull; import org.solovyev.android.ads.AdsController; import org.solovyev.android.calculator.model.CalculatorEngine; +import org.solovyev.android.errors.CustomExceptionHandler; /** * User: serso @@ -28,6 +29,7 @@ public class CalculatorApplication extends android.app.Application { public static final String AD_FREE_P_KEY = "org.solovyev.android.calculator_ad_free"; public static final String ADMOB_USER_ID = "a14f02cf9c80cbc"; + public static final String REMOTE_STACK_TRACE_URL = "http://calculatorpp.com/crash_reports/upload.php"; @NotNull private static CalculatorApplication instance; @@ -84,4 +86,8 @@ public class CalculatorApplication extends android.app.Application { builder.create().show(); } + + public static void registerOnRemoteStackTrace() { + Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(null, REMOTE_STACK_TRACE_URL)); + } } diff --git a/src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java b/src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java new file mode 100644 index 00000000..e3ee6fba --- /dev/null +++ b/src/main/java/org/solovyev/android/calculator/billing/CalculatorBillingService.java @@ -0,0 +1,17 @@ +package org.solovyev.android.calculator.billing; + +import net.robotmedia.billing.BillingService; +import org.solovyev.android.calculator.CalculatorApplication; + +/** + * User: serso + * Date: 2/12/12 + * Time: 1:45 PM + */ +public class CalculatorBillingService extends BillingService { + @Override + public void onCreate() { + super.onCreate(); + CalculatorApplication.registerOnRemoteStackTrace(); + } +}