Is there a way to find out whether the app is currently running or not?

Yes, you can achieve that in two ways:

  1. 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.
  2. Send a PubNub APN message and catch the alert via didReceiveRemoteNotification method on the iOS client. Similarly to #1, publish back via the method which will only be called while the app is running and foreground.