I’m creating a phonegap app for both (iOS/Android). I have subscribed to a specific event using (.onEvent), the problem is, when the iOS sleeps, wakes up again, it forgets the event and unsubscribes by itself.
A workaround would be to re-subscribe every time the device wakes, however, Android is different, sometimes it unsubscribes and sometimes it does not, so if I resubscribe it might have duplicate event listeners.
Is there a way I can clear all event listeners on a specific device object and re-add them all over again? Or if there is a better way to do it?
A similar scenario happens when the Connection (wifi or otherwise) is lost and reconnected.