Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4478] reverseGeocoder Platform Inconsistency

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2011-08-03T08:49:27.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sSprint 2011-29, Release 1.8.0
ComponentsAndroid
Labelsn/a
ReporterDawson Toth
AssigneeNatalie Huynh
Created2011-06-22T06:02:48.000+0000
Updated2018-12-17T17:57:07.000+0000

Description

Problem

The "country code" property is inconsistent between the platforms. On iOS it is "country_code", while for Android it is "CountryCode".

Solution

Pick one, and deprecate the other. Both platforms should expose the one chosen, and one can have the antiquated property for a couple more releases.

Sample Code

Ti.Geolocation.addEventListener('location', function(e) {
    Ti.Geolocation.reverseGeocoder(e.coords.latitude, e.coords.longitude, function(evt) {
        alert(evt);
    });
});

Associated Helpdesk Ticket

http://appc.me/c/APP-455583

Comments

  1. Reggie Seagraves 2011-06-23

    Dawson, Please update the sample code attached to this bug that exhibits the problem. I think that "country_code" would work on both platforms.
  2. Dawson Toth 2011-07-05

    "country_code" only works on iOS. Android return value does not contain this property. I just verified this statement is true on device, and in the source code using Release 1.7.1 and a build from source 6f5ab67357aa358d413f. See: https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/geolocation/src/ti/modules/titanium/geolocation/TiLocation.java#L352 And for the constant's definition see: https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/org/appcelerator/titanium/TiC.java#L137
  3. Don Thorp 2011-07-20

    Updated example code.
       
       Ti.Geolocation.addEventListener('location', function(e) {
           Ti.Geolocation.reverseGeocoder(e.coords.latitude, e.coords.longitude, function(evt) {
           	var m = "countryCode: " + evt.places[0].countryCode + 
           		" country_code: " + evt.places[0].country_code;
               alert(m);
           });
       });
       
  4. Bill Dawson 2011-08-01

    Additional (simpler) test if you're having problem with GEO on your device. This test just tests the affected code, which is the reverse geo lookup. The result should refer to Austria, since I'm giving the coordinates to Vienna, Austria here:
           Ti.Geolocation.reverseGeocoder(48.2, 16.3666667, function(evt) {
           	var m = "countryCode: " + evt.places[0].countryCode + 
           		" country_code: " + evt.places[0].country_code;
               alert(m);
           });
       
  5. Natalie Huynh 2011-08-25

    Tested with 1.8.0.v20110819142548 iPhone 4.3.4 iPad2 4.3.2 Motorola Xoom 3.2 Nexus One 2.2.2

JSON Source