react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

[IOS] Js code paused if proximity sensor closed

Open bmp123 opened this issue 6 years ago • 3 comments

hello, I have a problem. If proximity sensor close fast - js code paused. Is it possible do some thing when proximity sensor close fast and screen go off? I use react-native-background-timer to work in background but it not help.

Versions

- Callkeep: "^3.0.8"
- React Native: "0.61.5"

bmp123 avatar Jan 10 '20 06:01 bmp123

You need to patch RN module RCTTiming.m:

- (void)setBridge:(RCTBridge *)bridge
{
...
  if([[UIApplication sharedApplication] applicationState]!=UIApplicationStateActive){
    _inBackground =YES;
  }else{
    _inBackground = NO;
  }
...
  [[NSNotificationCenter defaultCenter] addObserver:self
                                           selector:@selector(proximityChanged)
                                           name:UIDeviceProximityStateDidChangeNotification
                                           object:nil];
...
}

-(void)proximityChanged
{
  BOOL state = [UIDevice currentDevice].proximityState;
  if(state==YES){
    [self appDidMoveToBackground];
  }else{
    [self appDidMoveToForeground];
  }
}

instead

- (void)setBridge:(RCTBridge *)bridge
{
...
    _inBackground = NO;
... 
}

it works for me.

Prussich avatar Jan 12 '20 20:01 Prussich

@bmp123 does this resolve you issue ? I don't think it's a callkeep issue.

manuquentin avatar Mar 10 '20 19:03 manuquentin

Closed due to inactivity. Please reopen the issue with some logs if you still reproduce it.

manuquentin avatar Jun 04 '20 15:06 manuquentin