I'm trying to implement location permission in Xamarin android. When My code reaches to line
IEnumerable placemarks = await Geocoding.GetPlacemarksAsync(latitude, longitude);
throws IOException with grpc failed error.
I'm getting this error on real device Samsung Galaxy S10+(Android 9). When I tried same code with different device Moto G6(Android 9) and Pixel XL Q(Android 10) emulator, then everything works good.
Exception which I got is
Java.IO.IOException: grpc failed at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <42748fcc36b74733af2d9940a8f3cc8e>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <42748fcc36b74733af2d9940a8f3cc8e>:0 at Android.Locations.Geocoder.GetFromLocation (System.Double latitude, System.Double longitude, System.Int32 maxResults) [0x0004b] in <9a14097a65a445eaa85f6a3a1ade52a3>:0 at Android.Locations.Geocoder+<>c__DisplayClass15_0.b__0 () [0x00000] in <9a14097a65a445eaa85f6a3a1ade52a3>:0 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534 at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 --- End of stack trace from previous location where exception was thrown ---
at Xamarin.Essentials.Geocoding.PlatformGetPlacemarksAsync (System.Double latitude, System.Double longitude) [0x0003d] in d:\a\1\s\Xamarin.Essentials\Geocoding\Geocoding.android.cs:15 at SpinSport.Client.Services.GeolocationRequester.RequestGeolocation (System.Action`1[T] onSuccess, System.Action onError) [0x000dc] in --- End of managed Java.IO.IOException stack trace --- java.io.IOException: grpc failed at android.location.Geocoder.getFromLocation(Geocoder.java:136)
Can someone please help me in this?
Thanks