Sergey Shustikov
Sergey Shustikov

Reputation: 15821

IOS send request to HTTP server when app received notification

I'm new in IOS development, and i try to work with push notifications

According to this article :

When the user’s device receives the push notification, it shows an alert, plays a sound and/or updates the app’s icon. The user can launch the app from the alert. The app is given the contents of the push notification and can handle it as it sees fit.

In Android development i have a Service which handle all PUSH-messages in application and i can send HTTP request from him when app received PUSH-message.

So i have a question - how i can do the same thing in IOS? (Send HTTP-request when app received PUSH-notification)

Upvotes: 2

Views: 829

Answers (1)

Nilesh Patel
Nilesh Patel

Reputation: 6394

If you app is in Foreground then its possible to make http call from delegate method. But if its in background mode then its not possible.

Alternatively you can do one thing if its feasible at your end. Whenever the notification will be generate it will be generated from the server so at the same time you can make call to your require http function.

If that is not possible then you can set certain setting on server & based on that when user open the application next time, You can make call to http request.

Hope this helps you.

Upvotes: 1

Related Questions