On Android, you need to receive messages via a background thread (use the Subscribe-At-Boot example to get started). Subscribe to PubNub in the background thread via a subscribe function, then use Android Intents to forward the message from the background thread to your app.

Note that the background thread can be run upon Android boot-up, so it will always be connected to PubNub. Next, the background thread will wake-up (or launch) the inactive (or non-running) app and send notification intents to the now-running app.


  • This method does not make use of Google GCM
  • Like FCM, to function through deep sleeps, a minimum wake lock level PARTIAL_WAKE_LOCK has to be set (to test, you can use WakeLock Power Manager app and set to #4, partial_wake_lock)

Alternatively, you can use FCM push notifications instead of a realtime connection in the background.