Skip to content

Beacon scan stops overnight #9

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

Open
uhw76tgwquerhjbqwnejk opened this issue Jun 26, 2019 · 23 comments
Open

Beacon scan stops overnight #9

uhw76tgwquerhjbqwnejk opened this issue Jun 26, 2019 · 23 comments

Comments

@uhw76tgwquerhjbqwnejk
Copy link

uhw76tgwquerhjbqwnejk commented Jun 26, 2019

Is there a set time limit for nearbee to stop scanning? When leaving the app open overnight and then walking by a beacon, it does not detect it. However, upon opening the app again it immediately detects the beacon. So it seems like the background scan works for a while but then stops. Has anyone else had this issue or any known workarounds?

I have the project setup exactly as the sample project describes.

@uhw76tgwquerhjbqwnejk
Copy link
Author

Here is a gist I made of my code: https://gist.github.com/JoeyBodnar/aaf291271d86ff5aaff80282e9f858a1

Also, under "Capabilities" I have both "Location updates" and "Uses Bluetooth LE Accessories" checked:

Screen Shot 2019-06-26 at 11 31 05 PM

@sachinmobstac
Copy link
Contributor

Hi @JoeyBodnar,

In the background, to get the beacon notification again, you should move away from the beacon region. We don't want to the user to get repeated notifications.

In the foreground we send you list of beacons found nearby.

Were you still in the beacon region?

@uhw76tgwquerhjbqwnejk
Copy link
Author

Yes, I will mention this to Ryan. Thank you.

@uhw76tgwquerhjbqwnejk
Copy link
Author

uhw76tgwquerhjbqwnejk commented Jun 27, 2019

He said that even if he turned on a different beacon, it would not detect it. For example:

  1. turn on beacon 1
  2. set app in background
  3. app detects beacon
  4. wait a few hours
  5. turn on beacon 2
  6. beacon 2 is not detected in the background
  7. opening the app immediately detects beacon 2

is this expected behavior?

@uhw76tgwquerhjbqwnejk
Copy link
Author

Also, if the app is force-closed, should it still be detecting beacons? or does it have to be open in the background to do so?

@uhw76tgwquerhjbqwnejk
Copy link
Author

Have you experienced this behavior before?

@sachinmobstac
Copy link
Contributor

Hi @JoeyBodnar,

The app requires Always Allow location permission so that it can display the notification when the app is killed. As it will be woken up in the background based on beacon region events.

There are certain restrictions on waking the app in the background. You mentioned to wait for few hours. The OS may have killed the app, please confirm if it isn't the case.

Once the app is killed we are relying on the beacon region events to scan and show the notifications.

@uhw76tgwquerhjbqwnejk
Copy link
Author

yes, I was told that the OS did kill the app, as it was awake in the background before at night, and the following morning the app was killed.

@uhw76tgwquerhjbqwnejk
Copy link
Author

Would you be willing to download our app via TestFlight and see if you can verify that it is operating correctly?

@sachinmobstac
Copy link
Contributor

Hi @JoeyBodnar, NearBee framework depends on EddystoneScanner SDK. I have fixed bluetooth state bug in the EddystoneScanner which sometimes caused the NearBee SDK not to trigger the scanning.

Can you please update it to 1.2.10 and see if it adversely affected your test cases?

After this, if you need further assistance please drop a mail to [email protected] and we can schedule a call to go through your use cases.

@uhw76tgwquerhjbqwnejk
Copy link
Author

yes indeed, I will update and continue testing. Thanks!

@uhw76tgwquerhjbqwnejk
Copy link
Author

So the problem is not 100% resolved. Here is all beacon related code in my app, from the info.plist, to App Delegate, to the view controller. I should note, the View Controller where we detect beacons is NOT the first root View Controller in the app, it is the second and appears after another view controller appears.

code: https://gist.github.com/JoeyBodnar/a0b06e306ada899ff2aca318360a6940

Is there anything in there that looks like it is not correct or could cause a potential problem?

@uhw76tgwquerhjbqwnejk
Copy link
Author

@sachinmobstac

@uhw76tgwquerhjbqwnejk
Copy link
Author

@sachinmobstac does anyone have any comment on this?

@ravipratapm
Copy link
Contributor

@JoeyBodnar Apologies, the person in charge of this is no more at the company. I am going to have someone else look at your code next week.

@uhw76tgwquerhjbqwnejk
Copy link
Author

Ok thank you.

@uhw76tgwquerhjbqwnejk
Copy link
Author

Is there any update on this? I was told 2 weeks ago that someone would look at the code last week, and then again that someone would look at it this week. it's already Thursday and just wanted to make sure it could get done this week, thank you.

@ravipratapm
Copy link
Contributor

@JoeyBodnar We checked the code and the function viewDidLoad() is not where the NearBee initialisation should be. Please move the relevant code to the didFinishLaunchingWithOptions method in the app delegate.

@ravipratapm
Copy link
Contributor

@JoeyBodnar Specifically, the nearBee.enableBackgroundNotifications(true) should be there.

@uhw76tgwquerhjbqwnejk
Copy link
Author

alright thank you! I will change the code and test it again.

@uhw76tgwquerhjbqwnejk
Copy link
Author

I put the initialization code in the didFinishLaunchingWithOptions in the AppDelegate but am still experiencing the problem where the app receives beacon notifications on first install, but never again after that.

Ryan said that there was a sample app that he tested that you all let him use and that it worked correctly. Could I see the code for that sample app so I can try to mimic it as much as possible?

@uhw76tgwquerhjbqwnejk
Copy link
Author

Is there any way for me to get the code from the working sample application?

@sourobrata
Copy link
Contributor

@JoeyBodnar The Sample App is available in this repository itself in the directory /SampleApp. Please note that the SDK requires Location Always permission to be able to deliver notifications in the background.

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

4 participants