danlg / lgen

lgen
MIT License
2 stars 1 forks source link

* Push notification deep links to the message thread in app. #236

Open danlg opened 8 years ago

danlg commented 8 years ago

When receiving a push notification, create a Deep link so that the recipient goes to message thread in app.

See also #83

terenceng2010 commented 8 years ago

https://github.com/nordnet/cordova-universal-links-plugin

terenceng2010 commented 8 years ago

https://github.com/katzer/cordova-plugin-local-notifications/issues/625

notifications for ios in foreground is not supported. It is by design. https://www.google.com.hk/search?q=notifications+for+ios+in+foreground&oq=notifications+for+ios+in+foreground&aqs=chrome..69i57.304j0j7&sourceid=chrome&es_sm=91&ie=UTF-8

https://webcache.googleusercontent.com/search?q=cache:k91FO9DGY78J:https://www.parse.com/questions/how-to-let-the-ios-notification-center-handle-push-notifications-when-an-app-is-in-the-foreground+&cd=8&hl=en&ct=clnk&gl=hk

As it happens, this is how iOS handles push notifications: if the app is in the foreground, iOS will not display the push notification alert or banner.

You can easily simulate push notification alerts with a UIAlertView, which is what handlePush: does when called from application:didReceiveRemoteNotification:. To display a banner, instead, you'll need to write your own custom view that is animated from the top of the app, and trigger the animation to start when a notification is received in application:didReceiveRemoteNotification:.

Make sure to check that [UIApplication sharedApplication].applicationState == UIApplicationStateActive is true, which indicates that the app was in the foreground already.