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.

ios10 branch: no action inside my app after receiving notification with app closed.

See original GitHub issue

Hi there,

I’m currently using #ios10 branch and testing local notifications.

I need to test 3 cases:

  1. App in foreground
  2. App running in background
  3. App not running

The both 3 cases works perfectly in any Android that I’ve tested and in iOS 9.

In IOS10 after a little searching i’ve got working in foreground using trigger event to do whatever I need to do. Also, if my app is running it works properly. But in case 3 i’ve got a problem in ios10.

The problem:

  • I receive the notification. I click in the notification. It opens my app and doesn’t do nothing. In my case, i need to show an inside popup when user clicks in the notification.

My code:

...
cordova.plugins.notification.local.on("click", function (notification) {
                //to show my custom popup with opened app.
                self.resolveNotification(notification);
            }, this);
          
....
if(ionic.Platform.isIOS() && ionic.Platform.version() >= 10){
            cordova.plugins.notification.local.on('trigger', function (notification) {
                
                    //to handle notification popup in foreground.
                    self.resolveNotification(notification);
               
            });
            }
...

Is there a proper way to handle it in IOS10 when the app is closed? What should I do?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
tfrenkencommented, Mar 10, 2017

Can confirm this. LocalNotifications.on(“click”, …) is trigged when clicking on notification and app is in foreground. When app is suspended / in background, the method is not called. This happens on Android 7, iOS10 and UWP. We use Ionic 2.0.0.

2reactions
steveracinecommented, Jan 31, 2017

I’m also seeing this behavior in iOS10. When the app is running in the foreground, the .on(‘trigger’…) callback will execute, but when the app is running the background, or not running, the function is never executed.

Can confirm that the event is received as expected and that the “click” event will be executed when the app is opened from the background, but “trigger” is not.

Should there be a different listener for the app running the background or not at all?

Read more comments on GitHub >

github_iconTop Results From Across the Web

For iOS 10, will application:didRe… | Apple Developer Forums
I am trying to make our app's push notification work on iOS 10 and have found application:didReceiveRemoteNotification:fetchCompletionHandler: won't be called ...
Read more >
ios - How to respond to local notification when app is closed in ...
But when the app is closed and I'm trying to answer to a notification, only "application didFinishLaunchingWithOptions" gets called, " ...
Read more >
Push notification is not received when the app is closed IOS 10
When de app is in background, when it go to the foreground mode, I receive an alert with the data of my push....
Read more >
Push Notification Troubleshooting for iOS - Braze
No “push registered” users showing in the dashboard · Check that your app is prompting you to allow push notifications. · Check you...
Read more >
Set up Google Workspace on an iOS device
(Enable Safari in your device settings at Settings and then ... How you add your account depends on the apps that you want...
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