Send Push notifications to iOS/Android on closed WiFi nework (no internet connection)

user2542225 picture user2542225 · Jul 2, 2013 · Viewed 23.6k times · Source

I would like to create an app that users can use in an area/venue where there is NO GSM/3G or any kind of cell reception. We also only provide a closed WiFi network without an internet uplink, so it's a LAN where devices (PC's and Smartphones) can communicate with each other but not with the outside world (don't ask why :)

The users will be instructed to download the app before they come to the venue.

My app needs to be able to receive push notification but of course it cannot reach Apple's APNS or Google cloud messaging services. The app however does register to our central server on the LAN with an IP. (it logs in when the user is connected to the WiFi network and we have the phonenumber that belongs to a registered phone.)

Now my question is: is there a way to send a push notification when an event is triggered and the app needs to wake up without using or connecting to Apple's or Google's online notification services?? E.g. an on premises push notification service that can be used to send a notification to a users phone based on an event that is triggered by our server?
Any suggestions?

Update: Just to clarify, it's a simple VoiP app that connects to our sip server and let's users call each other so it needs to be fairly real time for the two calls to connect. But apparently you can only wake the app up by push notification and therefor need internet.

Answer

CommonsWare picture CommonsWare · Jul 2, 2013

E.g. an on premises push notification service that can be used to send a notification to a users phone based on an event that is triggered by our server?

With respect to Android, the answer is "not really". Your options are:

  • Implement your "push" mechanism in the form of some message queue, where the devices poll looking for messages every so often, or

  • Use a WakeLock and WifiLock to keep the device (and WiFi) powered on constantly, then use something like MQTT for the push message

Either of these will be bad for the battery, though the first one is more configurable in terms of power drain (e.g., if you only check for messages once per hour, it won't be bad).

The reason why GCM can keep the power drain low is because of special hooks for mobile data connections within the OS and chipset, such that the CPU can power down while retaining an open socket connection to the push server, where incoming packets from that server will wake up the device. This is not available for WiFi.