You don’t need to have the app running in the background. Notifications can be pushed from the cloud.
Problem is, that costs money to host and run that job to check for notifications. This is why a lot of small developers end up burying notifications behind a paywall.