[TIMOB-17797] iOS: Add floor property from CLFloor needed for indoor geolocation
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-12-05T23:38:52.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 4.0.0 |
Components | iOS |
Labels | CLFloor, IndoorGeolocation, geolocation, ios |
Reporter | Andrew McElroy |
Assignee | Jon Alter |
Created | 2014-09-27T21:14:11.000+0000 |
Updated | 2015-11-05T18:47:32.000+0000 |
Description
In iOS 8 Apple introduced some APIs for indoor geolocation.
See: https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLFloor_class/
There is also a slide deck from WWDC 2014 talking about this in more detail.
It is a trivial change, but a useful one.
The only down side is that finding a list of buildings that have been mapped by Apple is a difficult task.
Here is the pull request: https://github.com/appcelerator/titanium_mobile/pull/6176
PRs master: https://github.com/appcelerator/titanium_mobile/pull/6392
Test case:
1. Run the code below 2. Click "start location updates" and once you get an update click "stop location updates" 3. Click "get current location" 4. For in both of these cases on iOS 8+ there should be a "floor" object with a "level" property in the location object printed to the console. Pre iOS 8 the "floor" property will not exist.Verified fix on: Mac OSX 10.10.2 Appcelerator Studio, build: 4.0.0.201502171827 Titanium SDK build: 4.0.0.v20150305101012 Titanium CLI, build: 3.5.0-dev Alloy: 1.6.0-alpha Xcode 6.1.1 iPhone 6 Plus(8.3b), iPhone 6 Plus(8.1.3), iPhone 5c (7.1.1) Built to devices, on an 8.x device the floor object is present in the location object and on a 7.x it is not present. Closing ticket
Our venue was recently surveyed by Apple in order to get indoor accuracy & Floor level, and I confirm this param shows correctly. An advise for developers, check the altitudeAccuracy returned if it's not -1 when using the floor property returned (~ 1 in 20 geolocation updates, it may return a *false* floor number of 0, thankfully it always returns also within that same object an altitudeAccuracy of >= 0, so you can drop those). Example: Untrustworthy Floor Level with Geolocation event: {"success":true,"coords":{"timestamp":1446397197000,"speed":0,"longitude":-73.xxx,"floor":*{"level":0}*,"latitude":45.yyy,"accuracy":10,"heading":-1,"altitude":30.46820068359375,"altitudeAccuracy":*4*},"code":0,"bubbles":true,"type":"location","source":{"preferredProvider":null},"cancelBubble":false} Trustworthy Floor Level with Geolocation event: {"success":true,"coords":{"timestamp":1446397183741,"speed":-1,"longitude":-73.xxx,"floor":{"level":1},"latitude":45.yyy,"accuracy":6.195938110351562,"heading":-1,"altitude":-1,"altitudeAccuracy":*-1*},"code":0,"bubbles":true,"type":"location","source":{"preferredProvider":null},"cancelBubble":false}