I'm currently developing an iOS application in swift. The App can already receive APN notifications (which contain coordinates). What I would like to do is to decide whether to display the notification or not based on the distance of the user form the location indicated by the coordinates included in the notification's data. Is it possible to do that? If not is there any way for the server to request from the application (even when in background or closed) the user's location before sending the APN request?
Thanks.
You could set up a silent push notification, which notifies your program, not the user. The payload could contain your coordinate, and your program could read the payload and decide if it needs to respond to the notification or not.