react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
251 stars 2 forks source link

Android: Foreground Service persistence #274

Open dkornilove opened 1 month ago

dkornilove commented 1 month ago

Environment

`System: OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa) CPU: (12) x64 AMD Ryzen 5 5600 6-Core Processor Memory: 2.08 GB / 7.76 GB Shell: version: "5.8" path: /usr/bin/zsh Binaries: Node: version: 18.14.0 path: ~/.nvm/versions/node/v18.14.0/bin/node Yarn: version: 1.22.19 path: /usr/bin/yarn npm: version: 9.3.1 path: ~/.nvm/versions/node/v18.14.0/bin/npm Watchman: Not Found SDKs: Android SDK: API Levels:

Things I’ve done to figure out my issue

I`ve implemented all the diffs from https://react-native-community.github.io/upgrade-helper/?from=0.71.6&to=0.74.1. Manually installed all the new versions from package.json.

Upgrading version

0.71.6 > 0.74.1

Description

I'm encountering an issue after upgrading from version 0.71.6 to 0.74.1 regarding the persistence of foreground service and notifications. I utilize the @notifee/react-native library to start a foreground service and display notifications. However, I've also experimented with other libraries, all with the same outcome.

Previously, my application exhibited the following behavior: Upon starting a foreground service and assigning value to a global variable (that persists out of App context) on button click, closing the app from the recent apps list resulted in the UI disappearing but the foreground service remaining active. Upon reopening the app from the icon or notification, the UI would remount, but the global variable retained its assigned value.

However, after the upgrade to 0.74.1, the behavior has changed. Now, upon closing the app from the recent apps list, the foreground service disappears. Subsequently, upon reopening the app, the global variable is empty as if it were the first launch.

It's worth noting that all other functionalities of my app are working properly.

Additionally, I cannot reproduce this issue on a freshly created React Native 0.71.4 app; everything works as expected, foreground service not stopping upon closing an app.

I've tried various troubleshooting steps without success and would greatly appreciate any insights or guidance

Reproducible demo

I can not share the app as it is commercial