Android and iOS don't let mobile apps run continuously in the background. If an app is closed or in the background, it generally can't talk to its own servers.
Instead, Google and Apple provide a service that allows the apps' servers to push a message even if the app is closed.