flutter-geocoding
flutter-geocoding copied to clipboard
[Feature request]:On Android 13, ISO CountryCode is always empty
Is there already an issue requesting this feature?
- [X] I have searched the existing issues.
Please select affected platform(s)
- [X] Android
- [X] iOS
Use case
countryCode=“”
Proposal
countryCode=“CN”
Specific requirements or considerations
No response
Additional information or context
No response
There is a similar problem in native Android, such as the United States, which previously returned US, but now returns "54003". If the plugin is written on the basis of native Android, I guess this is the reason
public static String getCountryCode(double lat,double lng) {
Geocoder geocoder = new Geocoder(Utils.getContext(), Locale.getDefault());
try {
List<Address> addresses = geocoder.getFromLocation(lat, lng, 1);
if (addresses.size() > 0) {
Address address = addresses.get(0);
// The numeric code returned in Android 13 is not the country number
return address.getCountryCode();
}
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
Dear @peng093,
Thanks for the information. It is true that we only pass the information from the native side to the dart side. So I'll close this issue for now because we cannot change anything about this for now.
Kind regards,