Comments (9)
You can try to specify false
for the useHttpClientHandler
parameter when registering AddGoogleApiClients()
.
Otherwise, I am not sure what you can do. I don't work with frontends, sorry
from googleapi.
Many thanks for your quick response.
I will try on this and take further investigating on the source code library.
from googleapi.
@Nguyenthanhtoa How did you fix this?
from googleapi.
Hi @PontusHolmberg,
I used the REST api to fetch the places data instead of library.
Reference: https://developers.google.com/maps/documentation/places/web-service/autocomplete
Feel free to ping me if you have any trouble when intergrating the REST api, I can share the sample code in .NET MAUI.
from googleapi.
@Nguyenthanhtoa
Oh, okey.
I actually solved the issue it self. Turns out that SetProxy is not supported on iOS by Maui even in .net8.
So i changed the HttpClientFactory and removed the Proxy argument when creating a new HttpClientHandler.
from googleapi.
Yes, sure. Great to hear that!
from googleapi.
@Nguyenthanhtoa Oh, okey. I actually solved the issue it self. Turns out that SetProxy is not supported by Maui even in .net8. So i changed the HttpClientFactory and removed the Proxy argument when creating a new HttpClientHandler.
Can you explain a little more ? I am facing the same issue in maui but in GoogleMaps.Geocode.LocationGeocode and i never created a HttpClientHandler. Thanks.
from googleapi.
@remi-appsolu I downloaded/cloned the github project and added it to my VS project, so I could modify the library.
Then inside HttpClientFactory you will find the function GetDefaultHttpClientHandler.
In there, I just changed
var httpClientHandler = new HttpClientHandler
{
Proxy = webProxy
};
To
var httpClientHandler = new HttpClientHandler();
That way it will never call SetProxy.
from googleapi.
Hi @remi-appsolu ,
As you can see in my issue description, the GoogleApi works properly on Android, but not on iOS. So, my workaround on iOS is using HttpClient to send an request to https://maps.googleapis.com/maps/api/place/autocomplete/json and get the places result like this:
using (var client = new HttpClient())
{
var path = "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=SEARCH_STRING&key=YOUR_API_KEY&types=(cities)&components=country:YOUR_COUNTRY_CODE";
HttpResponseMessage response = await client.GetAsync(path);
if (response.IsSuccessStatusCode)
{
var json = await response.Content.ReadAsStringAsync();
var predictionResponse = JsonConvert.DeserializeObject<PlacePredictionResponse>(json);
return predictionResponse.Predictions
.Select(p => new CityOfResidence { Name = p.Description, PlaceId = p.PlaceId })
.OrderBy(c => c.Name).Take(10).ToList();
}
}
Do not forget to add Newton.Json & handle exception
Ref: https://developers.google.com/maps/documentation/places/web-service/autocomplete
from googleapi.
Related Issues (20)
- Platform not supported exception in Blazor. HOT 1
- Send Place Detail Request with Basic and Contact fields HOT 1
- Retry policy HOT 2
- Routing API "GeocodingResults" doesn't seem to be a collection? HOT 2
- Status = OK when it shouldn't HOT 2
- Calling .Result from QueryAsync either hangs or causes a hard crash HOT 4
- Getting list of adresses when searching a street HOT 3
- Support for Nearby Search (New) HOT 2
- Entity fields returned by TextSearch API are inconsistent with rawjson data HOT 1
- Convert test projects to MS-Test
- .NET 7 target has issue with deps pointed from .NET8 HOT 4
- API Key required when Client ID alone should be sufficient HOT 1
- injecting own functionality HOT 6
- Error when trying to translate a HTML-Text HOT 5
- Inaccuracy in Distance Calculation Using Google Maps API with .NET 8.0 HOT 5
- Issue with language code "bg-Latn" HOT 3
- Enum JsonConverters are not applied
- Method summary for AutoComplete and QueryAutoComplete wrong? HOT 2
- TravelMode.WALKING is only supported in lower case HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googleapi.