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.

IOS deep linking handle on cold start

See original GitHub issue

** Which Category is your question related to? ** Push notification deep linking ** What AWS Services are you utilizing? ** push notifications, pinpoint ** Provide additional details e.g. code snippets ** When I receive notification and want to handle deep linking and redirect app, can’t do it on ios when app not running.

PushNotification.onNotification(notification => {
    handlePushNotification(notification);
    notification.finish(PushNotificationIOS.FetchResult.NoData);
});

onNotification simply never been called. I know there is also

PushNotification.onNotificationOpened(notification => {
  handlePushNotification(notification);
});

but this code works only for android https://github.com/aws-amplify/amplify-js/blob/master/packages/pushnotification/src/PushNotification.ts#L87

Linking doesn’t work either https://facebook.github.io/react-native/docs/linking#addeventlistener

Is there any other way to handle opening app with deep linking for ios? thank you

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
powerful23commented, May 22, 2019

@vitalii @BHesseldieck Hi, sorry for the late response. After some investigation around using push notification in IOS:

  1. To get the pushnotification body from cold start, you will need to use PushNotificationIOS.getInitialNotification(), as you can see the IOS part of Amplify Push Notification module is mainly using the PushNotificationIOS module from react-native. So as a workaround, you can directly use that module to get the notification body when the app cold starts.
  2. Unfortunately onNotificationOpened won’t work in IOS but you can change the behavior of onNotification. For now it will be triggered when the notification arrives. But if you unselect the Remote notifications in the Background Modes in xcode, then it will be triggered when the user taps the notification. You can find other ways to do that by checking this

As a conclusion, you can handle the deep linking by using PushNotificationIOS.getInitialNotification() when app cold starts or onNotification when app is in the background and the notification is tapped by the user.

We will continue investigating into this issue and provide more info in the documentation.

0reactions
github-actions[bot]commented, Jun 12, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing openURL to cold started app | Apple Developer Forums
I have an issue when opening the app from a URL (deep link) when the app is not in device memory and is...
Read more >
How can you debug opening universal links from a cold start?
Universal links & deep links works when I am already debugging the app. However I can't test opening a link from a cold...
Read more >
Deeplinking from a cold start with login requirement - Reddit
Currently - I have an situation where I want to deeplink to a page in my app that is not ready yet on...
Read more >
How to Implement Deep Link and ShortcutItems When Using ...
So in iOS 13, the correct way to handle open url and shortcut items is to store these items in scene(_:willConnectTo:options:) then perform ......
Read more >
Deep Linking at Scale on iOS - Just Eat Tech blog
The logic to perform deep linking starts with parsing the URL, understanding the intent, constructing the user journey, performing the ...
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