Package org.altbeacon.beacon.startup
Class RegionBootstrap
- java.lang.Object
-
- org.altbeacon.beacon.startup.RegionBootstrap
-
public class RegionBootstrap extends Object
Class allowing a user to set up background launching of an app when a user enters a beacon Region. Simply constructing and holding a reference to this class will cause background scanning for beacons to start on Android device startup. If a matching beacon is detected, the BootstrapNotifier didEnterRegion method will be called, allowing the application to launch an Activity, send a local notification, or perform any other action desired. Using this class as described above will also cause beacon scanning to start back up after power is connected or disconnected from a device if the user has force terminated the app. IMPORTANT NOTE: The RegionBootstrap class registers an internal MonitorNotifier with the BeaconManager. If you use the RegionBootstrap, your application must not manually register a second MonitorNotifier, otherwise it will unregister the one configured by the RegionBootstrap, effectively disabling it. When using the RegionBootstrap, any custom monitoring code must therefore be placed in the callback methods in the BootstrapNotifier implementation passed to the RegionBootstrap.
-
-
Constructor Summary
Constructors Constructor Description RegionBootstrap(Context context, MonitorNotifier monitorNotifier, List<Region> regions)Constructor to bootstrap your Application on an entry/exit from multiple regionsRegionBootstrap(Context context, MonitorNotifier monitorNotifier, Region region)Constructor to bootstrap your Application on an entry/exit from a single region.RegionBootstrap(BootstrapNotifier application, List<Region> regions)Constructor to bootstrap your Application on an entry/exit from multiple regionsRegionBootstrap(BootstrapNotifier application, Region region)Constructor to bootstrap your Application on an entry/exit from a single region.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRegion(Region region)Add a new regionvoiddisable()Used to disable additional bootstrap callbacks after the first is received.voidremoveRegion(Region region)Remove a given region
-
-
-
Field Detail
-
TAG
protected static final String TAG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RegionBootstrap
public RegionBootstrap(Context context, MonitorNotifier monitorNotifier, Region region)
Constructor to bootstrap your Application on an entry/exit from a single region.- Parameters:
context-monitorNotifier-region-
-
RegionBootstrap
public RegionBootstrap(Context context, MonitorNotifier monitorNotifier, List<Region> regions)
Constructor to bootstrap your Application on an entry/exit from multiple regions- Parameters:
context-monitorNotifier-regions-
-
RegionBootstrap
public RegionBootstrap(BootstrapNotifier application, Region region)
Constructor to bootstrap your Application on an entry/exit from a single region.- Parameters:
application-region-
-
RegionBootstrap
public RegionBootstrap(BootstrapNotifier application, List<Region> regions)
Constructor to bootstrap your Application on an entry/exit from multiple regions- Parameters:
application-regions-
-
-
Method Detail
-
disable
public void disable()
Used to disable additional bootstrap callbacks after the first is received. Unless this is called, your application will be get additional calls as the supplied regions are entered or exited.
-
addRegion
public void addRegion(Region region)
Add a new region- Parameters:
region-
-
removeRegion
public void removeRegion(Region region)
Remove a given region- Parameters:
region-
-
-