@@ -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