0

I'm trying to add a Native Module to my React Native project but I'm having difficulties receiving JS events when my phone is in sleep mode.

I've implemented event dispatchers as stated in the documentation here: https://facebook.github.io/react-native/docs/native-modules-ios.html#sending-events-to-javascript

And here is the specific code:

- (void)onIncomingCall:(PlivoIncoming*)incoming
{
    incall = incoming;
    [self.bridge.eventDispatcher
     sendAppEventWithName:@"onIncomingCall"
     body:nil];
}

This works fine when my app is in foreground and background.

Is there anyway to solve this?

EDIT Seems as though onIncomingCall is not triggered while in sleep mode. Any ideas why this might happen?

Ismailp
  • 2,333
  • 4
  • 37
  • 66
  • is `onIncomingCall` called? – Lou Franco Mar 05 '16 at 15:59
  • @LouFranco seems as it's not getting called in sleep mode for some reason. So this is absolutely the issue. – Ismailp Mar 05 '16 at 17:47
  • When the phone is asleep, your app is not running, Telephony APIs are not part of the approved for app store frameworks, so my guess is that library is meant to work with jailbroken phones. I don't think there is an approved way for an app to answer a phone call from sleep – Lou Franco Mar 06 '16 at 00:08
  • The documentation clearly states that you can have sockets open for VOIP applications which is what I'm building. So it should let it through. – Ismailp Mar 06 '16 at 14:01
  • @LouFranco https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html – Ismailp Mar 07 '16 at 08:03
  • Did you do all 4 steps under: "Implementing a VoIP App" – Lou Franco Mar 07 '16 at 14:19

1 Answers1

0

The answer to this question is that delegates work in background mode but not in inactive mode which sets in when the app/phone as been idle for > 15 mins.

Solution to this problem was to add a VOIP push to wake up the app so that delegates can be handled again.

Ismailp
  • 2,333
  • 4
  • 37
  • 66