question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tapping a notification in the notification centre can result in app being relaunched!

See original GitHub issue

To reproduce:

  1. Send an Android notification that does not contain a data element while the app is running in the background.

  2. Tap on the notification in the notification centre.

  3. 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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

21reactions
jk94commented, Jan 11, 2017

@npomfret @mikelambert thanks for your answers. I fixed my problems with an attribute in my AndroidManifest.xml. I added android:launchMode="singleTop" to the main activity element.

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

5reactions
Noitidartcommented, Jun 20, 2017

The deep linking docs recommend "singleTask" - https://facebook.github.io/react-native/docs/linking.html -

I havent tried the push notification module yet. But does anyone know how that compares to with @jk94 approach above of android:launchMode="singleTop"?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use notifications on your iPhone or iPad - Apple Support (CA)
Tap a single notification to open the app that it's from. Tap a group of notifications to view all recent notifications from that...
Read more >
Change notification settings on Apple Watch
To have the app once again notify you immediately, open the Settings app on your iPhone, tap Notifications, tap the app, then tap...
Read more >
Handling Notifications and Notification-Related Actions
Tapping one of the buttons forwards the selected action to your app, without bringing the app to the foreground. If your app supports...
Read more >
View and respond to notifications on iPhone - Apple Support
To see and hear these notifications again, swipe left on the notification in Notification Center, tap Options, then tap Unmute. Turn off notifications...
Read more >
Notifications - System experiences - Human Interface Guidelines
A notification gives people timely, high-value information they can understand at a glance.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found