[TIMOB-20268] Android does not return STATE from reverseGeocoder result (iOS does)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-02-11T02:29:54.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Android |
Labels | android, geocoder |
Reporter | Ryan Gartin |
Assignee | Hieu Pham |
Created | 2016-01-21T19:18:40.000+0000 |
Updated | 2016-06-23T22:58:55.000+0000 |
Description
Titanium.Geolocation.reverseGeocoder(location.coords.latitude, location.coords.longitude, function(e){
Ti.API.debug(JSON.stringify(e));
var big_location = generateBubble(e.places[0].city + ", "+ e.places[0].state, {type: 'city', coords: [location.coords.longitude, location.coords.latitude], place: e.places[0]});
$.cityState.text = "("+e.places[0].city + ", "+ e.places[0].state+")";
//result is "Savannah, (undefined)"
Works in iOS!
Looks like Android is building the address response manually, so we need to add the
state
key [here](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/geolocation/src/java/ti/modules/titanium/geolocation/TiLocation.java#L330-L348).[~hansknoechel] [~msamah] would it be better to just pass the server response through, so it is consistent with iOS, rather than build the address manually?
To be honest, I have no idea why its mapped manually. Would great to just come over object-encoded.
master PR: https://github.com/appcelerator/titanium_mobile/pull/7705
PR merged into master.
Verified the fix. Closing. Environment: Appc Studio : 4.7.0.201606150733 Ti SDK : 5.4.0.v20160617074028 Ti CLI : 5.0.9 Alloy : 1.9.0 MAC El Capitan : 10.11.4 Appc NPM : 4.2.7-2 Appc CLI : 5.4.0-18 Node: 4.4.4 Nexus 6 - Android 6.0.1