Is there a way to find out whether the app is currently running or not?
Yes, you can achieve that in two ways:
- Publish a ping message on a regular (non-APN) private channel. By having a device publish back when receiving a message on that channel, you know the app is running and in the foreground if you get a ping message back.
- Send a PubNub APN message and catch the alert via
didReceiveRemoteNotificationmethod on the iOS client. Similarly to #1, publish back via the method which will only be called while the app is running and foreground.