iBeacon advertising packet transmission time
This is a useful question in terms of getting an ideal lower bound on power usage by the device (excluding any compute power used by the device).
The BLE packet has a preamble of 1 byte, access address of 4 bytes, header of 2 bytes, MAC address of 6 bytes, data of up to 31 bytes, then a CRC of 3 bytes. That's a total of 46 bytes or 368 bits.
BLE has a supposed data rate of 1Mbit. According to this article, that excludes framing / error checking / connecting (although an advertising packet probably won't spend a lot of time connecting). So assuming the best case of 1Mbit=1024*1024, we can send 2849 advertising packets per second. That means each one is about 0.35 ms - in an ideal world. If the article is right, and the effective data rate is as much as 4x slower, it could be as long as 1.4 ms.
how to advertise in the background as a beacon when entering a beacon region
Sorry, iOS will not let your app advertise a BLE packet matching the iBeacon spec when it is in the background. As you have mentioned in your question, Apple alters the way background advertisements emitted in the background look, and as a result, they will not trigger CoreLocation enter events to wake up receiving apps in the background.
There are a few imperfect alternatives:
You can use other beacon advertisements in the background and wake up your app. This won't be as quick as iBeacon, but it will wake up your app within a few minutes. Here is a setup that does that: https://github.com/Decemberlabs/AltBeacon
You can advertise iBeacon whenever the app is in the foreground, and try to get the user to bring the app to the foreground through a local notification.
If there are other foreground copies of your app in the vicinity (based on background beacon detection), you can use a web service to notify them of your presence during the 10 seconds your app runs in the background. This notification can tell them to start advertising on your behalf.
Sending only one iBeacon Packet
Yes, you can use iBeacon technology to send information back and forth between two iOS devices without pairing. If you have two devices, Device A and Device B, you set both of them up to range for beacons with a common ProximityUUID, say, E2C56DB5-DFFB-48D2-B060-D0F5A71096E0. And then you can exchange information in the two byte major and minor fields.
What you can't do is control the transmitter enough to send only a single iBeacon advertisement. The transmitter in iOS sends out 10 advertisement packets per second, so the best you could do is start the transmitter then stop it on a timer about 100ms later. (You probably shouldn't do this, because there is no guarantee that a single iBeacon advertising packet will be received successfully by the other device -- it may be lost due to a CRC error in the radio noise. You are probably better off letting the packet continue to transmit until you can confirm from a response from the other device that it was received.)
You can see an example of starting and stopping a transmitter on a timer in my answer here.
Of course, there may be easier and more robust ways of accomplishing what you want with built-in Bluetooth data exchange mechanisms. But that doesn't change the fact that what you propose is certainly possible.
How does an ibeacon compute accuracy in terms of advertising interval and samples collected?
The exact algorithm that iOS uses to compute the CLBeacon
accuracy
property is closed source, and Apple has not revealed what it is. That said, experimentation has shown a few things:
The measurement approximates a distance in meters between an iPhone and a beacon.
It is based on a 20 second sample of RSSI measurements. You can see this by plotting a graph of
accuracy
over time and seeing that an immediate change in position of a mobile device or beacon is not fully reflected inaccuracy
for 20 seconds.Because of the inherent noise on RSSI measurements, higher advertising rates will give better distance estimates by having more statistical samples to smooth out the noise. iBeacons transmitting at 10Hz will have 200 statistical samples of RSSI over a 20 second period under ideal conditions.
Because the formula for calculating accuracy is not published by iOS, we came up with an independent algorithm that does something similar for the Android Beacon Library. You can see that formula here.
You can see a summary of my research into this area in this blog post.
Ipad Air not recognising iBeacon
You need to ask for location permission in iOS 8, and also added a the usage description string in your plist file.
Check out this answer for more detail: https://stackoverflow.com/a/24063578/361247
How to get faster ranging responses with AltBeacon?
Found the solution to this myself. I saw that the library will use a running average of the RSSI to calculate the distance. The sample expiration time is by default 20 seconds. This would explain the gradually updating distance.
So calling
RangedBeacon.setSampleExpirationMilliseconds(5000);
with 5 seconds being just what I was experimenting with, gives a faster response time and so far a good detection rate of the regions.
Related Topics
Requestaccessformediatype Doesn't Ask for Permission
Swift Updating Screen in Between Steps of While Loop
How to Get Video Duration Fro Avasset in Swift
Array Search Function Not Working in Swift
How to Use Dispatchgroup/Gcd to Execute Functions Sequentially in Swift
Xcode 8.0 Cbcentralmanager Issue
Arkit Setting Worldtrackingconfiguration to Gravityandheading Produces Error
Different Path Url for Filemanager Everytime I Open the App
Url Constructor Doesn't Work with Some Characters
Unrecognized Selector Sent to Instance When No Related Entities Found in Core Data
Swift - Pass JSON Data to Other Views
Why Won't My Collection View Cells Display in the iPhone Simulator
How to Use Core Data Value from Picker? #Swiftui #Coredata
Var Declaration with Type VS Without
Finding All Types That Conform to a Protocol
Can't Append Value to My Nsarray Variable
Custom Cell with Uitableview Inside Uicollectionviewcell
How to Properly Test Against Certain Values in Nseventmodifierflags via Swift