Skip to content
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

Reopening the app when clicking a notification #2433

Open
George3d6 opened this issue Feb 16, 2025 · 4 comments
Open

Reopening the app when clicking a notification #2433

George3d6 opened this issue Feb 16, 2025 · 4 comments

Comments

@George3d6
Copy link

Is there any way, at least in cases where the app is in the background or foreground (i.e. not killed) to get the notification click behavior to just => opening the app (foregrounding it) or doing nothing (if the app is foregrounded).

At present it opens a deep-link to trackplayer://notification.click and I can't even figure out how to configure said link.

@lovegaoshi
Copy link
Contributor

RTFM and the example app

function deepLinkHandler(data: { url: string }) {

@George3d6
Copy link
Author

George3d6 commented Feb 22, 2025

@lovegaoshi what I meant to say is "could I change this link to be something else"

Figuring out how to get "trackplayer://notification.click" to "do nothing except foreground app" is a bit difficult, since it's behavior will be router dependant. I can capture it with Linking but there is no "now ignore all resulting rendering changes from the fact that the path has changed" option in Linking (that's router dependant) => Handling trackplayer://notification.click without navigation results in an invalid state (route not found) and handling trackplayer://notification.click by navigating to a valid route results in... an app refresh, because you're navigating.

Hence my original point.

Though in this specific case, I did manage to find an expo-router specific way to get the behavior I wanted(~ish).

Supporting a deep link that's not trackplayer://notification.click might help. The docs point to that being the case but mention no way of configuring it, nor can I find one in the example app.

@MarianLudwig
Copy link

@lovegaoshi This works fine on Android. However, the deepLinkHandler is not being called on iOS when clicking the notification. Is this a known limitation?

@lovegaoshi
Copy link
Contributor

so u r a user of expo-router that thinks every single deeplink is a navigation request. This has nothing to do with how RNTP handles things, rather u should post in the expo issue board instead and ask how to ignore certain deeplink URI from their router.

the example app shows exactly not doing anything about the deeplink but logging. I do direct to another screen, and I cannot relate since i dont use the opinionated expo-router framework.

if u google trackplayer://notification.click in this repo u'd find this is only in one .kt file, ie. its android only. the docs is poorly made but since its strictly under the android section, u can assume its android exclusive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants