0

I have a Service which implements BeaconConsumer and BootstrapNotifier. In this case I need to call beaconManager.bind(this); to bind BeaconManager in startBeaconManager method. But also I use RegionBootstrap to range beacons. As RegionBootstrap includes beaconManager.bind(beaconConsumer);, it causes not to start ranging any beacons. Note that I have also stopBeaconManager method to unbind BeaconManager.

Do you have any suggestion to handle this situation?

Alper Tekin
  • 173
  • 1
  • 2
  • 14

1 Answers1

0

Understand that RegionBootstrap is just a convenience class for setting up monitoring that makes it easier to set up background detections when combined with an Application class. If you are creating your own Service instance that is a BeaconConsumer and launching the service on app startup automatically, there probably is no reason to use RegionBootstrap.

Just do the bind call in the service's onCreate method, and start monitoring when you get the call to onBeaconServiceConnected.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Thank you for your answer. I have to use `RegionBootstrap` for sending push notification to user in case of detecting a certain/registered beacon in a Region in `didEnterRegion` method. What if I move `RegionBootstrap` to Application class and still use `BeaconConsumer` in my Service? Any binding problems, overlap? – Alper Tekin Aug 04 '16 at 08:16
  • Actually I should do that even if app is killed. So I do need Service, can't do that in Application class. – Alper Tekin Aug 04 '16 at 08:24
  • I do not understand why RegionNootstrap cannot be put in an Application class as designed. – davidgyoung Aug 04 '16 at 11:36
  • Please correct me if I am wrong. I understand that if I use RegionBootstrap in Application class, I won't be able to detect if a beacon is seen in the Region if the app is not running both in foreground and background(killed). I have certain uuid of the beacons so I define in Region. And click the keyfob(beacon) button, notification appears. I think the key here is I try to create Regions and start ranging in onBeaconServiceConnect. Whenever you have time, I may tell you shortly in detail what I do and want to do in chat if possible. – Alper Tekin Aug 04 '16 at 13:04