Beaconstac / NearBee-iOS-SDK

Beaconstac NearBee SDK for iOS
https://www.beaconstac.com
MIT License
1 stars 1 forks source link

Beacon scan stops overnight #9

Open JoeyBodnar opened 5 years ago

JoeyBodnar commented 5 years ago

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.

JoeyBodnar commented 5 years ago

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 commented 5 years ago

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?

JoeyBodnar commented 5 years ago

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

JoeyBodnar commented 5 years ago

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?

JoeyBodnar commented 5 years ago

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?

JoeyBodnar commented 5 years ago

Have you experienced this behavior before?

sachinmobstac commented 5 years ago

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.

JoeyBodnar commented 5 years ago

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.

JoeyBodnar commented 5 years ago

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

sachinmobstac commented 5 years ago

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 support@beaconstac.com and we can schedule a call to go through your use cases.

JoeyBodnar commented 5 years ago

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

JoeyBodnar commented 5 years ago

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?

JoeyBodnar commented 5 years ago

@sachinmobstac

JoeyBodnar commented 5 years ago

@sachinmobstac does anyone have any comment on this?

ravipratapm commented 5 years ago

@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.

JoeyBodnar commented 5 years ago

Ok thank you.

JoeyBodnar commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

JoeyBodnar commented 5 years ago

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

JoeyBodnar commented 5 years ago

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?

JoeyBodnar commented 5 years ago

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

sourobrata commented 3 years ago

@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.