This repository contains the mobile iOS SDK that can be used in order to read the beacons installed within the Beacon Suedtirol project.
- IDE (XCode 10 recommended)
- pod (you can get it from https://cocoapods.org/)
2. Add the following line to relevant targets (look for latest release in repository and replace "x.y.z")
pod 'BZBeaconSDK', '~> x.y.z'
class YourViewController: BZBeaconScannerDelegate
let manager = BZNearbyBeaconManager.instance
manager.setBeaconScannerDelegate(beaconScannerDelegate: self)
manager.startScanning()
func didDiscoverIBeacon(_ iBeacon: IBeacon) {
...
}
Offer a better experience to your app users by implementing a background data fetch in your app. This will check periodically for updated beacon infos. By doing so, you ensure that your users will always see fresh data, even when they are offline.
Select your app target, and under Capabilities
, activate Background Modes
-> Background fetch
In the didFinishLaunchingWithOptions
method of your AppDelegate
, add the following line:
UIApplication.shared.setMinimumBackgroundFetchInterval(1800)
This sets the update in seconds. 30 Minutes as in this example is the minimum.
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let manager = BZNearbyBeaconManager.instance
manager.refreshBeacons() {infos in
if (infos != -1) {
if (infos! > 0) {
completionHandler(.newData)
} else {
completionHandler(.noData)
}
} else {
completionHandler(.failed)
}
}
}
You can modify this method if you need, but always call the completionHandler as in this example since this is important for future scheduling of the task!
- KontaktSDK - Creative Commons Attribution NoDerivs (CC-ND)
- Alamofire - MIT
See LICENSE.md
This project is REUSE compliant, more information about the usage of REUSE in NOI Techpark repositories can be found here.
Since the CI for this project checks for REUSE compliance you might find it useful to use a pre-commit hook checking for REUSE compliance locally. The pre-commit-config file in the repository root is already configured to check for REUSE compliance with help of the pre-commit tool.
Install the tool by running:
pip install pre-commit
Then install the pre-commit hook via the config file by running:
pre-commit install