wix / react-native-notifications

React Native Notifications
MIT License
3.25k stars 765 forks source link

App relaunch on notification click. #1006

Open vishaledkey opened 1 year ago

vishaledkey commented 1 year ago

Issue When the app is not killed, tapping on either background or foreground notifications relaunches the app on Android. I have used postLocalNotification() for showing foreground notifications.

Library version

"react-native-notifications": "^5.0.0"
"react": "18.2.0",
"react-native": "0.71.6",

Manifest changes

<activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
            android:exported="true"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:requestLegacyExternalStorage="true"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

Expected behavior The app shouldn't be relaunched when it is already open or running in the background (Recents)

Step to reproduce

  1. Open the app
  2. Put it in the recents
  3. send the push notification
  4. click on it, and the app will relaunch.
aoligama commented 9 months ago

@vishaledkey did you find a solution?

ersel commented 8 months ago

any solutions for this?

ilight commented 7 months ago

Same issue here after updating the app to latest 5.1.0

vishaledkey commented 6 months ago

@vishaledkey did you find a solution?

I'm using the Notifee library to handle the local notifications for now.

ilight commented 6 months ago

@aoligama @ersel I ended up patching v5.1.0, here is my patch that works fine https://gist.github.com/ilight/be7141f45f15e39b6fccfe46ca6e3829

helgahjartar commented 6 months ago

@aoligama @ersel I ended up patching v5.1.0, here is my patch that works fine https://gist.github.com/ilight/be7141f45f15e39b6fccfe46ca6e3829

Facing this problem as well - would it be possible to open these changes up as a pull request?

andrewroar commented 6 months ago

I have thwe same issue too please help