Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-24535

iOS: Ti.Geolocation Speed returning incorrect number or -1 for speed, requires docs-clarification

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 6.1.0
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      iOS, SDK 6.0.2.GA

    • Sprint:
      2017 Sprint 09 SDK

      Description

      When listening for the location event for iOS, the speed returned is very often -1 and sometimes an incorrect value. It's very inconsistent. This was working before with our previous app release with SDK 5.5.0.GA but it no longer does with the newest SDK 6.0.2. I also tried rolling back to 5.5.0.GA but this doesn't seem to fix the issue either.

      index.js:

      var numOfCalls = 0;
      var locationCallback = function(e) {
      	$.numOfLocationCalls.text = "Num of calls: " + numOfCalls;
      	numOfCalls++;
      	if (!e.success || e.error) {
      		$.labelSpeed.text = "Error:" + JSON.stringify(e);
          } else {
          	var mph = e.coords.speed * 2.23694;
          	$.label.text = "Speed: " + mph;
          	var overSpeed = (e.coords.speed > 5) ? true : false;
          	$.labelSpeed.text = "Over speed: " + overSpeed;
          }
      };
       
      Ti.Geolocation.addEventListener('location', locationCallback);
      Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
      Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
      Ti.Geolocation.distanceFilter = 5;
       
      $.index.open();
      

      index.xml:

      <Alloy>
      	<Window class="container">
      		<View layout="vertical" height="Titanium.UI.SIZE">
      			<Label id="label">Hello, World</Label>
      			<Label id="labelSpeed">Hello, World</Label>
      			<Label id="numOfLocationCalls">Hello, World</Label>
      		</View>
      	</Window>
      </Alloy>
      

      in tiapp.xml, I have these permissions:

      <key>NSLocationWhenInUseUsageDescription</key>
      <string>Your location will only be used when the app is running.</string>
      

      NOTE: I tried adding this to the axway support portal as I am a enterprise developer, but I can't seem to login at the moment. Will likely be adding this there once I get that sorted out.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                amandavines Amanda
                Reviewer:
                Eric Wieber (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-10571
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration