Check ApplicationState from NEAppPushProvider

I'm trying to implement the Local Push Connectivity logic. I managed to implement them correctly, I would need to understand from the extension if the main application is active in the foreground or in the background is it possible? currently I do not find anything that can give me this information.

Thanks for any support
As with most Network Extension Providers, the Network Extension and the container app can have different life-time expectancies. For example, the container app may only be available a short amount of time while the Network Extension can stay active as long as the device has not gone into sleep mode. Can you tell me more about what you are looking to here?


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Thanks for your answer, I try to explain myself better.

I want to understand how to manage the coexistence of online and offline notifications. Assuming (for example) that my network (identified by my SSID) has connectivity, how should I prevent both online and offline notifications from activating? (it's a somewhat forced example, but I need it to better understand the problem).

I hope I have clarified my doubt.
Unfortunately there isn't any built-in mechanism or API to let you know if the device is reachable by APNs or not.

What you could do is to use a two pronged approach:
  • use a Notification Service Extension to let your local notification server know that the device is receiving online notifications

  • have a back channel between your local notification server and your online one that checks whether there is connectivity, and whether the device indeed received the notification that was sent.

And based on the statuses of the above, trigger the notification from the local server or not. Of course, one can think of other ways of doing this with varying reliability and extra traffic.
thanks for your reply
Check ApplicationState from NEAppPushProvider
 
 
Q