Making API calls after receiving a notification

Hello, I have a tasks to make an app such that once receive FCM notification, get current SSID and current location, then send it to our server, even if this app is in background (not active) or being killed from app switcher(not sure if it's the correct name, user swipe up to remove apps). Now it works for a couple of hours after putting the app to background, but with a time limit I don't know it stops working.

I personally think it cannot be done, but could somebody please confirm it?

If an app is terminated then it won't get launched when it receives a background push, so you can't do it that way.

However it is possible if a notification service extension is capable of getting the location, but you would have to request an entitlement from Apple. If you implement a notification service extension to intercept the push, the extension is capable of making a connection to your server. I don't know if the extension is capable of obtaining the location, you'd have to experiment and see if it is. Some extensions are limited in their capabilities but the notification service extension is capable of doing a lot of things. The problem is the push notification that the extension receives has to be displayed to the user. Unless you can get a notification filtering entitlement, that would enable the notification from not being displayed to the user. The entitlement can be applied for through the Apple developer account, you have to give a justification to Apple why you want/need it.

Making API calls after receiving a notification
 
 
Q