IPhone networking in the background

Is it possible to have an application for the iPhone that continues to listen to data on the port when it is sent to the background by the user, and if any data arrives, the application can show a local notification and alert the user? I know multitasking is intentionally limited, but does this allow this?

+4
source share
2 answers

He can, but with the main reservations:

  • First, the system will unregister the Bonjour names that you may have installed.
  • Secondly, if you are attached to WWAN, it will go down even with you, listening to it (this is true even in the foreground).
  • Thirdly, if your application does not do anything else in the background (i.e. is not registered to provide background music, location events or telephony), you should still complete the work within the deadline for completing the background task or stop working.

So, although you can bind and listen on a socket in the background, for almost all practical purposes, this is not worth doing, and you should rethink your design.

+5
source

This is exactly what you need for push notifications. Your application does not listen on your server, your server informs Apple of any notifications, and the Apple server delivers them to the user and your application if the user wants them.

+2
source

Source: https://habr.com/ru/post/1333526/


All Articles