spotny-sdk 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of spotny-sdk might be problematic. Click here for more details.
- package/README.md +5 -3
- package/ios/SpotnyBeaconScanner.swift +8 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,9 +31,11 @@ Add the following keys to your `Info.plist`:
|
|
|
31
31
|
<string>We use Bluetooth to scan for nearby beacons.</string>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Enable **Background Modes** in Xcode → Signing & Capabilities:
|
|
35
|
-
- Location updates
|
|
36
|
-
- Uses Bluetooth LE accessories
|
|
34
|
+
Enable **Background Modes** in Xcode → your app target → **Signing & Capabilities** → **+ Capability** → Background Modes:
|
|
35
|
+
- ✅ Location updates
|
|
36
|
+
- ✅ Uses Bluetooth LE accessories
|
|
37
|
+
|
|
38
|
+
> **Important — avoid crash on launch:** If your app does **not** enable the *Location updates* background mode, the SDK will still work for foreground-only scanning. However, if you enable it in Xcode, the `UIBackgroundModes: [location]` entry is added to `Info.plist` and the SDK will automatically enable background scanning. Omitting this while calling `startScanner` is safe — the SDK detects the missing capability at runtime and skips the background-location setting. Earlier versions (< 0.3.4) would crash with `NSInternalInconsistencyException` if the background mode was not declared; this is fixed in **0.3.4+**.
|
|
37
39
|
|
|
38
40
|
### Android
|
|
39
41
|
|
|
@@ -88,8 +88,14 @@ public class SpotnyBeaconScanner: NSObject {
|
|
|
88
88
|
|
|
89
89
|
locationManager = CLLocationManager()
|
|
90
90
|
locationManager.delegate = self
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
// allowsBackgroundLocationUpdates = true requires the app to declare the
|
|
92
|
+
// "location" UIBackgroundModes entry. Setting it without that entitlement
|
|
93
|
+
// raises NSInternalInconsistencyException and terminates the app.
|
|
94
|
+
if let modes = Bundle.main.object(forInfoDictionaryKey: "UIBackgroundModes") as? [String],
|
|
95
|
+
modes.contains("location") {
|
|
96
|
+
locationManager.allowsBackgroundLocationUpdates = true
|
|
97
|
+
locationManager.pausesLocationUpdatesAutomatically = false
|
|
98
|
+
}
|
|
93
99
|
|
|
94
100
|
beaconManager = KTKBeaconManager(delegate: self)
|
|
95
101
|
}
|