答案 0 :(得分:1)
答案 1 :(得分:1)
为城市搜索添加此行
&components=locality:ahmedabad
特定城市内的搜索地址
答案 2 :(得分:0)
使用GeoCoder
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
Geocoder geoCoder = new Geocoder(Injector.INSTANCE.getApplicationComponent().applicationContext(), Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName(
"City name", 5);
if (addresses.size() > 0) {
Log.d(TAG,"ADRESSE "+ addresses.get(0) +",LAT :" + addresses.get(0).getLatitude() +", LONG :" + addresses.get(0).getLongitude() );
}
} catch (IOException e) {
e.printStackTrace();
}