I schedule a timer to read RSSI using the readRSSI function, but when my app goes into the background The timer stops, the app comes in the background, so the peripheral notification is a good way to get the RSSI price but I do not know how to do anybody can help me? Anyone have a better way?
I have a single problem, and I have two ideas.
1.
First of all, you should have some service that can be received from Core Bluetooth representatives from time to time. F or my example, I have a battery service that has been updated with me time code with Second, set the readSSSSI function in This works fine for me, but I got another idea from some sample code. 2. Whenever you want to start an RSS reader, use the code below: This works fine for me as well. didUpdateValueForCharacteristic The timely representative can be found.
didUpdateValueForCharacteristic . And do not forget to set background mode with Corebluetooth. Now you can update RSSI when updating.
NSTimer * rssiTimer; [Invalid RSS timer]; RssiTimer = [NSTimer timer with timer: 1.0 Goal: Peripheral Selector: @Selector (Reid RSSI) userInfo: Zero repeats: Yes]; [[NSRunLoop currentRunLoop] addTimer: rssiTimer forMode: NSRunLoopCommonModes];
No comments:
Post a Comment