diff --git a/app/src/main/java/com/tomjanson/wifilocationlogger/MainActivity.java b/app/src/main/java/com/tomjanson/wifilocationlogger/MainActivity.java
index 762669e..caa209d 100644
--- a/app/src/main/java/com/tomjanson/wifilocationlogger/MainActivity.java
+++ b/app/src/main/java/com/tomjanson/wifilocationlogger/MainActivity.java
@@ -1,10 +1,15 @@
package com.tomjanson.wifilocationlogger;
import android.app.Activity;
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.location.Location;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
+import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
@@ -263,6 +268,7 @@ void stopLocationUpdates() {
log.trace("Stopped location updates");
} else {
log.warn("Attempted to stop location updates, but not connected");
+ onWarn();
}
}
@@ -365,6 +371,7 @@ public void onConnected(Bundle connectionHint) {
@Override
public void onConnectionFailed(ConnectionResult result) {
log.warn("GoogleApiClient connection failed: ConnectionResult.getErrorCode() = {}", result.getErrorCode());
+ onWarn();
}
@Override
@@ -404,4 +411,23 @@ public void removeFocusFromEditText(View view) {
public void triggerUpload(View view) {
Uploader.upload(this, "/sdcard/WifiLocationLogger/wifilog.csv");
}
+
+ private void onWarn() {
+ try {
+ Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
+ Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
+ r.play();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ new AlertDialog.Builder(this)
+ .setTitle(getString(R.string.warning))
+ .setMessage(getString(R.string.warning_msg_logged))
+ .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ })
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .show();
+ }
}
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 9751c55..cfd5113 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -18,4 +18,6 @@
Fehler: Upload fehlgeschlagen!
Fehler: Logdatei wurde nicht gefunden
Upload erfolgreich
+ Achtung
+ Ein Ereignis der Kategorie „WARN“ oder höher wurde geloggt. Bitte sende das Debug-Log an den Entwickler. Die App verhält sich wahrscheinlich fehlerhaft.
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2346049..f8db51a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -21,4 +21,6 @@
Error: Upload failed!
Server
Server URL
+ Warning
+ An event of category “WARN” or higher was logged. Please send the debug log to the developer. It is likely that the app is misbehaving.