DeviceEventEmitter stops emitting events to application when screen locked

1.4k views Asked by At

I'm capturing location information with a native module and attempting to send it via a DeviceEventEmitter to my application:

[self.bridge.eventDispatcher sendDeviceEventWithName:@"locationUpdated" body:locationEvent];

This works great when the screen is on. However, when the screen is locked, React Native stops pushing these events to my application. It does eventually push them, but only after the screen is unlocked. This is suboptimal - is there a way to have React Native keep pushing them even when the screen is locked such that my app can continually process them?

1

There are 1 answers

0
Colin Ramsay On BEST ANSWER

I wonder if this is related to "[Timer] React Events not fired if the device is locked and screen turned off"? It would depend on how DeviceEventEmitter is implemented internally but it would certainly seem to be a good starting point and jaygarcia gives a few more hints in the comment thread that he's seeing the same problem you are. The good news is that the last comment on the issue indicates that this could be getting fixed pretty soon.