Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background mode doesn't work ! #46

Open
jonathanroze opened this issue Feb 4, 2017 · 3 comments
Open

Background mode doesn't work ! #46

jonathanroze opened this issue Feb 4, 2017 · 3 comments

Comments

@jonathanroze
Copy link

jonathanroze commented Feb 4, 2017

Hey,

I'm working on an app which send a notification to user when a ibeacon is around him ! But i have a problem, when my app is running on screen, everything works but when i go on home, nothing ! The application do anything !

I've enabled Background Mode, add some key in info.plist ! I've tried to add some line :

 if ([launchOptions objectForKey:@"UIApplicationLaunchOptionsLocationKey"]) {
    NSLog(@"DID RECIEVE REGION");
}

And i have set

Beacons.requestAlwaysAuthorization();

But it's not fired ! Do you have an idea?

My react-native version : 0.40
IOS : 10.2

Thank you!

@shodanuk
Copy link

shodanuk commented Feb 6, 2017

I'm having the exact same problem. I believe that the javascript is running ok in the background as I'm seeing logs from regionDidEnter & regionDidExit event handlers but I don't believe didFinishLaunchingWithOptions is firing at all

@shodanuk
Copy link

shodanuk commented Feb 8, 2017

I got this working... eventually.

It appears that didFinishLaunchingWithOptions does not fire when a regionDidEnter event is triggered when the app is in the background. I tried this with a pure native iOS app and it displayed the same behaviour, so I don't think it has anything to do with React Native or this library.

As I mentioned in my last comment, regionDidEnter & regionDidExit continue to fire when the app is in the background so it's quite possible to listen for these events and trigger a location notification from your Javascript code.

Check out react-native-push-notification for a cross platform notification lib.

@nikolakanacki
Copy link

@shodanuk how exactly did you get any of this to work? I've had no luck with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants