implement ACRA

This commit is contained in:
Ruben van de Ven 2020-01-28 21:36:25 +01:00
parent 9ed9bd0d58
commit 4d491a411e
5 changed files with 23 additions and 4 deletions

View file

@ -10,6 +10,9 @@
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_LOGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:name=".AppContext"
android:allowBackup="true"

View file

@ -2,7 +2,6 @@ package com.rubenvandeven.emotionhero;
import android.graphics.Bitmap;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
/**
* Created by ruben on 10/09/16.

View file

@ -41,7 +41,7 @@ import cz.msebera.android.httpclient.entity.StringEntity;
*/
public class ApiRestClient {
private static final String BASE_URL = "https://api.emotionhero.com"; // TODO: https!
private static final String BASE_URL = "https://api.emotionhero.com";
/**
* For some reason validation of SSL certificate needs to be disabled (using true).

View file

@ -10,6 +10,13 @@ import android.os.PowerManager;
* For kioskmode only!
* See http://www.andreas-schrade.de/2015/02/16/android-tutorial-how-to-create-a-kiosk-mode-in-android/
*/
@ReportsCrashes(
buildConfigClass=BuildConfig.class,
formUri="http://crashes.rubenvandeven.com/api",
formUriBasicAuthLogin="com.rubenvandeven.emotion_hero.kiosk",
formUriBasicAuthPassword="4fkpp89Q+VKdbVj3VIbBFKTT",
mode=ReportingInteractionMode.TOAST,
resToastText=R.string.crash_toast_text)
public class AppContext extends Application {
private AppContext instance;
private PowerManager.WakeLock wakeLock;
@ -20,8 +27,10 @@ public class AppContext extends Application {
public void onCreate() {
super.onCreate();
instance = this;
registerKioskModeScreenOffReceiver();
startKioskService();
if (!ACRA.isACRASenderServiceProcess()) {
registerKioskModeScreenOffReceiver();
startKioskService();
}
}
private void registerKioskModeScreenOffReceiver() {
@ -31,6 +40,12 @@ public class AppContext extends Application {
registerReceiver(onScreenOffReceiver, filter);
}
protected void attachBaseContext(Context paramContext)
{
super.attachBaseContext(paramContext);
ACRA.init(this, new ConfigurationBuilder(this).setReportField(ReportField.USER_COMMENT, false), true);
}
public PowerManager.WakeLock getWakeLock() {
if(wakeLock == null) {
// lazy loading: first call, create wakeLock via PowerManager.

View file

@ -23,4 +23,6 @@
<string name="permission_yes">Sure!</string>
<string name="ending_winner">You are the one and only <i>Emotion Hero</i>!</string>
<string name="ending_loser">You have finished all steps in the training, and many peers have done the same. It is too bad that many scored better than you. Try smiling better next time!</string>
<string name="crash_toast_text">Sorry, Emotion Hero just crashed.</string>
</resources>