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

It is not work when app is in background. #8

Closed
JacobVinu opened this issue Jun 13, 2018 · 4 comments
Closed

It is not work when app is in background. #8

JacobVinu opened this issue Jun 13, 2018 · 4 comments

Comments

@JacobVinu
Copy link

JacobVinu commented Jun 13, 2018

I am developing an app that work in background. I add a geofence and put the app in background. After that BBLocationManagerDidEnterFence method will not work. Why? Is it doesn't work in background mode?

@JacobVinu JacobVinu reopened this Jun 13, 2018
@benzamin
Copy link
Owner

When in the background, if a geofence is entered or exited, the app will come silently to foreground to execute the code written inside the geofence enter/exit trigger method. But the execution of the method is limited to certain features and time. How you are writing the code? If you do a network/API call it will work, you can also fire a local notification. But if you want to show a alert, it wont work.

Hope this helps, if you still have some confusion, please provide some example code.

@JacobVinu
Copy link
Author

I want to call an API when the user geofence is entered or exited. And also trigger a local notification. If the user start the navigation and put the device in pocket and travel, how can we call the API when user geofence is entered or exited? is there any solution?

@benzamin
Copy link
Owner

Its easy to add API calls when a fence is entered or exited in the background.

First make sure you have set up everything, including the info.plist keys(refer the documentation). Then implement the BBLocationManagerDelegate protocal add your API calls + Local notification in the following methods:

-(void)BBLocationManagerDidEnterFence:(BBFenceInfo *)fenceInfo
-(void)BBLocationManagerDidExitFence:(BBFenceInfo *)fenceInfo

Refer to the sample app included in the project for details

@benzamin
Copy link
Owner

@JackobVinu Did u do the implementation correctly? If so please close ghe issue. Otherwise let me know if you have any further query.

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

2 participants