Skip to content

[Timer] React Events not fired if the device is locked and screen turned off. #1282

@mintuz

Description

@mintuz

If you have a delegate method that is fired every X seconds in the background when the device is locked. The delegate method is fired but the event is not. The following code

This log message Is triggered when the device is locked and screen is inactive.

NSLog(@"userUUID found %@", userUUID);

This event is triggered if the device is locked but the screen needs to be active.

[self.bridge.eventDispatcher sendDeviceEventWithName:@"nearByUserFound" body:@{@"userUUID":userUUID}];
//
//  ProximityManager.m
//  Proximity
//
//  Created by Adam Bulmer on 07/05/2015.
//  Copyright (c) 2015 Adam Bulmer All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ProximityManager.h"

@implementation ProximityManager

  @synthesize bridge = _bridge;

// MARK: React Native Bridge

  RCT_EXPORT_MODULE()

  RCT_EXPORT_METHOD(startAdvertising:(NSString *)appUUID
                    userUUID:(NSString*)userUUID) {
    self.proximity = [[Proximity alloc] initWithAppUUID:appUUID userUUID:userUUID delegate:self];
  }

  // MARK: ProximityDelegate Callbacks.

  - (void)nearbyUserFound:(NSString *)userUUID {
    NSLog(@"userUUID found %@", userUUID);
    [self.bridge.eventDispatcher sendDeviceEventWithName:@"nearByUserFound" body:@{@"userUUID":userUUID}];
  }

@end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions