Skip to content

Commit 84f4b5e

Browse files
committed
Possible fix for #613
1 parent f00b782 commit 84f4b5e

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

iNaturalist/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
android:installLocation="auto"
5-
android:versionCode="638"
6-
android:versionName="1.37.2">
5+
android:versionCode="639"
6+
android:versionName="1.37.3">
77

88
<uses-permission android:name="android.permission.INTERNET" />
99
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

iNaturalist/src/main/java/org/inaturalist/android/INaturalistService.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -603,23 +603,13 @@ public int onStartCommand(Intent intent, int flags, int startId) {
603603
return super.onStartCommand(intent, flags, startId);
604604
}
605605

606-
// Only use the notification for actions for which their response is crucial (e.g. syncing)
607-
// (but make sure we call it at least once)
606+
// Make sure we call startForeground in order to avoid this crash:
607+
// https://issuetracker.google.com/issues/76112072?pli=1
608608
String action = intent.getAction();
609609
Logger.tag(TAG).info("Should call startIntentForeground? " + mApp.hasCalledStartForeground() + ":" + action);
610610

611-
if (!mApp.hasCalledStartForeground() ||
612-
Arrays.asList(new String[]{
613-
ACTION_DELETE_OBSERVATIONS, ACTION_DELETE_ACCOUNT, ACTION_FIRST_SYNC,
614-
ACTION_GET_AND_SAVE_OBSERVATION, ACTION_JOIN_PROJECT, ACTION_LEAVE_PROJECT,
615-
ACTION_PASSIVE_SYNC, ACTION_POST_MESSAGE, ACTION_PULL_OBSERVATIONS,
616-
ACTION_REDOWNLOAD_OBSERVATIONS_FOR_TAXON, ACTION_REFRESH_CURRENT_USER_SETTINGS,
617-
ACTION_REGISTER_USER, ACTION_SYNC,
618-
ACTION_SYNC_JOINED_PROJECTS, ACTION_UPDATE_USER_DETAILS, ACTION_UPDATE_USER_NETWORK
619-
}).contains(action)) {
620-
mApp.setCalledStartForeground(true);
621-
startIntentForeground();
622-
}
611+
mApp.setCalledStartForeground(true);
612+
startIntentForeground();
623613

624614
return super.onStartCommand(intent, flags, startId);
625615
}

0 commit comments

Comments
 (0)