I need to get the city and state from latitude and longitude. Geocoder does this function to get the city and state. But I am getting an error java.io.IOException: grpc failed
in below line only on Android real device. It is working fine in emulators.
new Geocoder(context).getFromLocation(latLng.latitude, latLng.longitude, 1).get(0);
Also I have been calling this function using Asynctask which is suggested in another post Geocoder grpc failed in stack overflow but nothing works for me.
And I have restart the device as well but still it is failing.
Help needed here. Thanks in advance.
Note: I tested in Google Pixel XL, Samsung S6 edge, Samsung S4.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…