When I use call getFromLocationName I get an IOException with description \"grpc failed\".
Code that\'s ran
@Override
public void onMapReady(GoogleMa
This was happening also on my Samsung S7 Edge phone with Oreo installed.
It only happened when I had an airplane mode on (not always - means something might have been cached at some points). I didn't explore the guts of Geocoder but I assume it requires some sort connectivity to get the information (that would also explain why this is happening so often on emulators).
For me the solution was to check the network connectivity status and call this only when status != NETWORK_STATUS_NOT_CONNECTED.
For this you can implement a broadcast receiver, that will listen to any status changes on network.
Register receiver
IntentFilter networkFilter = new IntentFilter();
networkFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
getActivity().registerReceiver(NetworkChangeReceiver, networkFilter);
Setup broadcast receiver to handle the broadcast
private BroadcastReceiver NetworkChangeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
int status = NetworkUtil.getConnectivityStatusString(context);
if (status == NetworkUtil.NETWORK_STATUS_NOT_CONNECTED) {
} else {
// do your stuff with geocoder here
}
}
};