0

I want the application not be shown when tapping on the notification.
I want to do some background task or just simply open a URL but not the application.
For instance, I found that I can simply add web view in my application or open the browser to open the url, but how can I prevent showing the application(not bring it to foreground)?
I also don't want to do the background task with silent push notification as I want to show this notification to the user.

Fattaneh Talebi
  • 727
  • 1
  • 16
  • 42
  • Check these methods here https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SchedulingandHandlingLocalNotifications.html#//apple_ref/doc/uid/TP40008194-CH5-SW14. – Kamran May 08 '18 at 04:41
  • When you know that app is launched from the notification then you should be able to handle the first UI, in your case webView or whatever you want. – Kamran May 08 '18 at 04:43
  • @Kamran thanks, but I don't want to show the web view in my app I want to open the url in browser and not show the app to user – Fattaneh Talebi May 08 '18 at 04:57
  • You can simply use UIApplication.shared.openURL when the app is opened from a notification. – koropok May 08 '18 at 05:08
  • It’s opens automatically. However you can implement the notification actions instead. – Mannopson May 08 '18 at 05:18
  • @koropok so the user see that the app is opened? – Fattaneh Talebi May 08 '18 at 05:18
  • @Mannopson yes exactly, I could do this with notification action, the app was not shown to the user but it did some background task. I wonder if it could be done without notification action. – Fattaneh Talebi May 08 '18 at 05:21
  • @FattanehTalebi It’s the system responsibility. I think you can’t implement. – Mannopson May 08 '18 at 06:08

0 Answers0