The number of questions on SO related to iBeacon and its background capabilities is increasing and there is some confusion on that point.
I have been testing the AirLocate project.
iBeacon has 2 "capabilities": Region monitoring and Ranging.
Region monitoring is limited to 20 regions and can function in the background (of the listening device) and has different delegates to notify listening app (and user) of entry/exit in the region - even if app is in the background or phone is locked.
Ranging works only in the foreground but will return (to the listening device) an array (unlimited?) of all iBeacons found along with their properties (UUID, etc..)
In addition, that 20 regions monitoring is a device limit. If the user is using geofencing reminders, other apps that use region monitoring; this will lower that number.
So are we saying that I can not deploy a mall-wide (100 stores+) app that uses store iBeacons to send a "store specific" notification to the user, while the app is in the background or the phone is locked?
I gather that the advertising device (the beacon) has to be in the foreground as well to advertise a region that the listening device could "enter" into. So are we saying, that if the owner of a store had an iOS device; I could not for example save him money by asking him to use his iPhone (at least early on) as an advertising device (beacon) - since the app will likely not always be in the foreground?
So in the case of iBeacon + MLB, a single UUID (or <20 UUIDs) is/are used for the app to possibly determine entry door and, then will the user be required to unlock the phone/bring the app to the foreground to use it (find seat, etc..)?
Can I then call the iBeacon: a single location/event (store, park, etc..) feature that requires the user's most "foreground" attention to have a "complete" practical use case?
I have tried to be articulate about the user cases to bring it to practical. Please reply with more than yes or no.
Sounds like you are on the right track. In general you are correct that an app needs to be in the foreground to fully use iBeacon capabilities. A few specifics on your three main questions:
Your mall use case can work with a couple of limitations. (a) you have to conserve your CLBeaconRegions by having many or all 100 stores share the same UUID and/or major number, differing only in the minor number. This allows you to set up a single CLBeaconRegion to monitor many. (b) If the app wakes up into the background from seeing iBeacon 1, it won't be able to wake up a second time from seeing iBeacon 2 in the same CLBeaconRegion unless it first stops seeing any other beacon in that CLBeaconRegion. (You can game this a bit by setting up several CLBeaconRegions and trying group stores so adjacent ones in the overlapping 50 meter bluetooth radio range are in different CLBeaconRegions.)
No, a store owner cannot use their iPad act as an iBeacon in the background -- it has to be in the foreground to work. But they can have their Windows or Mac computer do this using a virtual iBeacon program. My company offers one for free download: http://developer.radiusnetworks.com/ibeacon/
In the door entry use case, yes, the user would have to acknowledge the notification on the lock screen to bring the app into the foreground. A typical implementation would use a single CLBeaconRegion (probably with all iBeacons sharing a ProximityUUID and maybe even a major) to alert the user.
Edit 4/11/2020: Apple announced plans for a new beacon advertisement that will work in the background. See here for more info.
Related
I'm making an iBeacon based app for a shopping mall with notifications based specifically on which store is nearby.
My question is, with background tasks in iOS 7.1 and above, can I run database calls(to reference location on the basis of the closest beacon). What about network calls(like a PFQuery?).
Yes, you can do anything you want on iBeacon detection in the background including database access and web service calls. I have developed apps doing both of these things. The only trick is that iOS only gives your app 5-10 seconds of running time after the detection takes place, so you must make these operations relatively fast.
At my current level of knowledge, I think it is not possible, to develop an emergency or time critical alarm app for Windows 8.1 as a Windows Store App (no Desktop).
Maybe also Windows Phone 8 would fit such app scenario, for having smaller devices to carry around.
For (fictitious) example you have a blind person walking down a road, now he or she unfortunately enters a area, where no one should walk around without seeing something, then the app should warn the person with a toast notification (with sound or vibration) or some UI related function if the app is on top but the Screen is turned off.
As Windows 8.1 sets time limits to the background tasks to safe battery life, I think it is not possible to build such an app on that plattform.
A similar scenario is this question Location tracking windows 8, but it was Windows 8 he asks about and now it is 1 year over and I hope there is something new which I have missed.
Maybe there is way to hook up the Tracking Service?
If the interaction works for you, you would want to create a windows phone app that supports running in the background much the way that GPS navigation applications work (the application must be navigating for it to run in the background).
How to run location-tracking apps in the background for Windows Phone 8
Monitoring geolocation this way will be timely and you can create toast notifications, but you have to be wary of when the application will be deactivated. Whether the platform will work for you depends on your requirements and centers around deactivation. Take a look to see if the conditions for deactivation don't meet your standards, and implement a proof of concept.
i'm close to finish an App using Estimote beacons having their UUID
hardcoded in my project which list out all the Estimote beacons using ibeacon API, but when i'm trying to make my own device as a beacon transmitter using the Device UUID, which is differ from the estimote UUID, i cannot find it, as the UUID which i mentioned in the code is Estimote's.
So my question is , is there any way that i can find all the beacons(Ex- Estimote Beacons, Kontakt Beacons, Blue cat Beacons and ibeacon hardware) which i can track with apple's ibeacon API?
With same code i wanted to track all beacons without hardcoding any UUID?
is it possible?
No,Apple has put restriction on finding of unknown Ibeacon .You can not find any unknown beacon.Though there are some hacks which are not that effective.Also there can not be more than one Udid a app region can contain.What you can do either is that ask the user what Udid he wants to monitor then the app can range for it.
Sorry for wrong spelling if any..
No, you must tell CoreLocation the ProximityUUID of any iBeacon you want your app to see or it will not tell you about it. See http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html
This does not mean you need to hardcode every UUID in your app. Doing so would require you to resubmit the app for approval each time you add an iBeacon with another UUID.
An alternative is to use a web service to give you a list of UUIDs to search for. You can build your own, or use my company's ProximityKit service that does this for you.
I wrote a test bench app for my company that has an array of UUIDs. It saves a default set of UUIDs to user defaults using the registerDefaults call.
The user can then create new UUIDs at will, as well as sharing them with other devices. (I Use a UIActivity, so you can share via AirDrop, messages, email, etc.)
It lets you input a UUID as hex digits, or you can tap a "create new UUID" button to generate a new UUID.
I included the Estimote UUID as well as the 3 UUIDs Apple includes, and a couple of unique ones.
Our test bench app then uses the list of UUIDs for both transmitting and receiving beacon IDs.
So while the UUIDs are stored locally, they are not hard-coded.
You could certainly also fetch a list of UUIDs from a web service as David proposes, or use iCloud to fetch a user-defined list of IDs across all devices that use the same AppleID.
A bitter truth for those who want to discover arbitrary iBeacons and their uuids.
There doesn't seem to be any hack to look for an arbitrary iBeacon on iOS -- you have to know at least the ProximityUUID to see one.
Using CoreBluetooth is pretty useless for working with iBeacons. You can see their advertisements, and measure the signal strength, but you can't see any of the identifiers, and thus, you don't even know for sure if any advertisement you see is an iBeacon at all, versus any other BluetoothLE device.
Is there a way how to get list of all devices connected to the Bluetooth peripheral?
I want to connect to iBeacon and check if another iPhone is connected to it.
No, two reasons why not:
iBeacons are not connected to the iOS device, iBeacons are broadcast only and no back communication exist from the phone to the beacon.
Knowing details of other BT 4.0 Centrals connected to a Peripheral are not in line with the the privacy features of Bluetooth 4.0. iOS and other Centrals are are using resolvable private addresses, in order to avoid situation like you are describing.
#barbazoo is correct that you cannot do exactly what you are asking because iBeacons only transmit data -- they have no idea what devices see them.
You can accomplish something similar, however, if you have an app running on each of the iOS devices you mention, and you have a server where you can build a web service. The web service would expose two methods:
reportIBeaconVisible(iBeaconProximityUUID, iBeaconMajor, iBeaconMinor, myPhoneAdvertisingId)
queryVisiblePhones(iBeaconProximityUUID, iBeaconMajor, iBeaconMinor)
The app would report each iBeacon it sees using the first method, passing the iBeacon's identifiers, along with the phone's advertising identifier to the server.
The app could then use the second method to ask the server what other phones have seen the exact same iBeacon, which would return a list of phone advertising identifiers.
You'd have to have logic on the phone to only report data to the server at a reasonable frequency. You'd also need code on the server to automatically delete phone records in the list if the phones haven't reported seeing a beacon in a certain time interval.
The application will select a random latitude and longitude to create a point which the user must find.
The user's distance from the point will be displayed using a "hot-cold meter", which will change color depending on the distance. This meter must constantly update, which would require that I constantly retrieve the user's location. I would also need to use kCLLocationAccuracyBest. However, this sounds like it would use up a lot of battery.
Can I do anything to save battery?
From the official documentation
Gathering location data is a power-intensive operation. It involves powering up the onboard radios and querying the available cell towers, Wi-Fi hotspots, or GPS satellites, which can take several seconds. Leaving the standard location service running for extended periods can drain the device’s battery. (The significant-change location service drastically reduces battery drain by monitoring only cell tower changes, but the service works only on devices with cellular radios.) For most apps, it is usually sufficient to establish an initial position fix and then acquire updates only periodically after that. If you are sure you need regular position updates, you should use the significant-change location service where you can; otherwise, you should configure the parameters of the standard location service in a way that minimizes its impact on battery life.
http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html
PS: On the same link there's a section at the bottom of the page with other tips too :)
My iphone app runs 8 hours of recording fixes evey second on iphone4. The display needs much more power. Dont worry. Measure how long you can record. Then claim, not before.