diff --git a/briar-android/src/main/java/org/briarproject/briar/android/BriarService.java b/briar-android/src/main/java/org/briarproject/briar/android/BriarService.java
index c88bf061b..3e77d52c0 100644
--- a/briar-android/src/main/java/org/briarproject/briar/android/BriarService.java
+++ b/briar-android/src/main/java/org/briarproject/briar/android/BriarService.java
@@ -22,6 +22,7 @@ import org.briarproject.bramble.api.system.AndroidExecutor;
import org.briarproject.briar.R;
import org.briarproject.briar.android.logout.HideUiActivity;
import org.briarproject.briar.android.navdrawer.NavDrawerActivity;
+import org.briarproject.briar.android.splash.SplashScreenActivity;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -221,6 +222,7 @@ public class BriarService extends Service {
super.onLowMemory();
LOG.warning("Memory is low");
shutdownFromBackground();
+ showLowMemoryShutdownNotification();
}
private void shutdownFromBackground() {
@@ -245,6 +247,24 @@ public class BriarService extends Service {
}).start();
}
+ private void showLowMemoryShutdownNotification() {
+ androidExecutor.runOnUiThread(() -> {
+ NotificationCompat.Builder b = new NotificationCompat.Builder(
+ BriarService.this, FAILURE_CHANNEL_ID);
+ b.setSmallIcon(android.R.drawable.stat_notify_error);
+ b.setContentTitle(getText(
+ R.string.low_memory_shutdown_notification_title));
+ b.setContentText(getText(
+ R.string.low_memory_shutdown_notification_text));
+ Intent i = new Intent(this, SplashScreenActivity.class);
+ b.setContentIntent(PendingIntent.getActivity(this, 0, i, 0));
+ b.setAutoCancel(true);
+ Object o = getSystemService(NOTIFICATION_SERVICE);
+ NotificationManager nm = (NotificationManager) o;
+ nm.notify(FAILURE_NOTIFICATION_ID, b.build());
+ });
+ }
+
/**
* Waits for all services to start before returning.
*/
diff --git a/briar-android/src/main/res/values/strings.xml b/briar-android/src/main/res/values/strings.xml
index 14de9071b..c67a15e35 100644
--- a/briar-android/src/main/res/values/strings.xml
+++ b/briar-android/src/main/res/values/strings.xml
@@ -411,4 +411,7 @@
You have denied access to the camera, but adding contacts requires using the camera.\n\nPlease consider granting access.
Camera permission was not granted
+
+ Signed out of Briar
+ Signed out due to lack of memory.