From 4f4c3b5ea5193d02a167f6d8cc28dee3a0217e3a Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Sat, 10 Feb 2024 15:26:04 -0800 Subject: [PATCH] Wrap notification updates in try catch to avoid errors due to premature teardown on lower resource devices. --- .../kolibri/src/main/java/org/learningequality/Task.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python-for-android/dists/kolibri/src/main/java/org/learningequality/Task.java b/python-for-android/dists/kolibri/src/main/java/org/learningequality/Task.java index 7ed83bf3..1f9dc965 100644 --- a/python-for-android/dists/kolibri/src/main/java/org/learningequality/Task.java +++ b/python-for-android/dists/kolibri/src/main/java/org/learningequality/Task.java @@ -188,7 +188,12 @@ public static void updateProgress( String id, String notificationTitle, String notificationText, int progress, int total ) { NotificationRef ref = Worker.buildNotificationRef(id); - Manager manager = new Manager(ContextUtil.getApplicationContext(), ref); - manager.send(notificationTitle, notificationText, progress, total); + try { + Context context = ContextUtil.getApplicationContext(); + Manager manager = new Manager(context, ref); + manager.send(notificationTitle, notificationText, progress, total); + } catch (Exception e) { + Log.e(TAG, "Failed to update progress", e); + } } }