Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17797] iOS: Add floor property from CLFloor needed for indoor geolocation

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-12-05T23:38:52.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsiOS
LabelsCLFloor, IndoorGeolocation, geolocation, ios
ReporterAndrew McElroy
AssigneeJon Alter
Created2014-09-27T21:14:11.000+0000
Updated2015-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

Comments

  1. Jon Alter 2014-11-24

    PRs master: https://github.com/appcelerator/titanium_mobile/pull/6392
  2. Jon Alter 2014-11-24

    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.
       var win = Ti.UI.createWindow({
       	backgroundColor: "white",
       	layout: 'vertical'
       });
       win.open();
       
       addButton({
       	title: 'start location updates',
       	callback: function(e) {
       		Ti.Geolocation.addEventListener('location', onLock);
       	}
       });
       
       addButton({
       	title: 'stop location updates',
       	callback: function(e) {
       		Ti.Geolocation.removeEventListener('location', onLock);
       	}
       });
       
       addButton({
       	title: 'get current location',
       	callback: function(e) {
       		Ti.Geolocation.getCurrentPosition(function(e) {
       			Ti.API.info("get CURRENT");
       			onLock(e);
       		});
       	}
       });
       
       function addButton(args) {
       	var b1 = Ti.UI.createButton({
       		title: args.title,
       		top: 40
       	});
       	b1.addEventListener('click', args.callback);
       	win.add(b1);
       }
       
       function onLock(e) {
       	Ti.API.info("# COORDS: " + JSON.stringify(e.coords));
       }
       
  3. Ewan Harris 2015-03-06

    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
  4. Joseph Sachs 2015-11-05

    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}

JSON Source