A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: handle crash in background on device boot
Ammar Ahmed3770091b58ed
diff --git a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/BootRecieverService.java b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/BootRecieverService.javaindex 519f289d0..5768ce6af 100644--- a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/BootRecieverService.java+++ b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/BootRecieverService.java@@ -14,19 +14,21 @@ public class BootRecieverService extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {- if (!isAppOnForeground((context))) {- /**- We will start our service and send extra info about- network connections- **/- Intent serviceIntent = new Intent(context, BootTaskService.class);- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {- context.startForegroundService(serviceIntent);- } else {- context.startService(serviceIntent);- }- HeadlessJsTaskService.acquireWakeLockNow(context);- }+ try {+ if (!isAppOnForeground((context))) {+ /**+ We will start our service and send extra info about+ network connections+ **/+ Intent serviceIntent = new Intent(context, BootTaskService.class);+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {+ context.startForegroundService(serviceIntent);+ } else {+ context.startService(serviceIntent);+ }+ HeadlessJsTaskService.acquireWakeLockNow(context);+ }+ } catch (Exception ignored) {}}private boolean isAppOnForeground(Context context) {