-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tapping a notification in the notification centre can result in app being relaunched! #281
Comments
I'm having this same exact issue. Considering moving to a "data" payload, but would prefer to stay with the "notification" payload if at all possible. Any thoughts around this one? |
@npomfret i'm having the same issue too. But i can't fix it with a data attribute. Am I doing it wrong? Can you show me how you fixed this? |
I've not fixed it. @mikelambert have you any idea what's happening here? |
So without a This might be fixed by switching to headless tasks added in RN 0.36. Are we perhaps willing to break compatibility with RN versions older-than-that at this point? I'm focused on other things at the moment for the next couple months, but can do the migration the next time I dig into the mobile/notification code. Alternately, comparing the Headless JS code and the RN-PN code developed independently, it looks like the only thing I had forgotten was the wake-lock (I think unrelated) and the listener-removal (maybe multiple identical listeners are the source of the problems?) |
@npomfret @mikelambert thanks for your answers. I fixed my problems with an attribute in my AndroidManifest.xml. I added <activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
...
</activity> Maybe this helps s.b. else! |
@mikelambert sorry for the slow reply, been travelling. I like your theory about the listener removal. Have you tried replacing your code with the built in RN headless tasks? |
Nope. Please see the second paragraph of my message above. :p |
The deep linking docs recommend I havent tried the push notification module yet. But does anyone know how that compares to with @jk94 approach above of |
Hi i'm currently having this issue, when app is in background and show localnotification it launch the app when i clicked on notification. |
Why was this closed? What was the solution? |
Hi @nikolajskov |
Thanks @Dallas62 |
I ran into this issue but with different setup. My app is not invoking the This post has a fix in this particular scenario: crazycodeboy/react-native-splash-screen#289 I hope that helps anyone! |
To reproduce:
Send an Android notification that does not contain a
data
element while the app is running in the background.Tap on the notification in the notification centre.
Repeat a few times.
What I noticed is that when tapping the notification my app appeared to re-launch itself even though it was already running. After trying a couple of times I realised that the app was launching multiple copies of itself - each tap resulted in a new instance of the JS app... but only 1 runtime - so I have multiple apps running side by side with a single UI!
It does not appear to happen if the push notification contains a
data
element.The text was updated successfully, but these errors were encountered: