I have a ble device that transmits custom data in iBeacon frame. I need to capture the data continuously even when the app is quit forcefully. entry exit event does fire randomly and that time data i am able to get it. But its not always. Also i need to get the data always even when i am inside the region of that device.
Below is my code, but its not working. Is it doable or not? any other alternate options?
func startMonitoring(uuidString: String?) {
let defaultUUIDString = bleUUID
let uuid: UUID
if let s = uuidString, let parsed = UUID(uuidString: s) {
uuid = parsed
} else if let parsedDefault = UUID(uuidString: defaultUUIDString) {
uuid = parsedDefault
} else {
uuid = UUID()
}
let constraint = CLBeaconIdentityConstraint(uuid: uuid)
let region = CLBeaconRegion(beaconIdentityConstraint: constraint, identifier: "SmartTagRegion")
region.notifyOnEntry = true
region.notifyOnExit = true
region.notifyEntryStateOnDisplay = true
manager.startMonitoring(for: region)
manager.requestState(for: region)
manager.startRangingBeacons(satisfying: constraint)
}