Risoluzione dei problemi
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Ecco alcuni suggerimenti per risolvere i problemi più comuni.
Perché il raggio di precisione è molto ampio?
Se la risposta di geolocalizzazione mostra un valore molto elevato nel campo di precisione, il servizio potrebbe geolocalizzare in base all'IP della richiesta, anziché ai punti di accesso Wi-Fi o alle torri cellulari. Questi tipi di risposte possono verificarsi se il servizio non
riconosce torri cellulari o punti di accesso.
Per confermare che il servizio non è riuscito a geolocalizzare i tuoi punti di accesso, imposta
considerIp
su false nella tua richiesta. Se la risposta è 404, hai
confermato che gli oggetti wifiAccessPoints e cellTowers non sono stati geolocalizzati.
Come faccio a risolvere un errore di risposta?
Se la richiesta genera un errore, il sistema restituisce un corpo della risposta di errore in formato standard
e imposta il codice di stato HTTP su uno stato di errore.
La risposta di errore contiene un oggetto con un singolo oggetto di errore con le
seguenti chiavi:
code
: è uguale allo stato HTTP della risposta.
message
: una breve descrizione dell'errore.
errors
: un elenco degli errori che si sono verificati. Ogni errore contiene un identificatore per
il tipo di errore (il motivo) e una breve descrizione (il messaggio).
Ad esempio, l'invio di JSON non valido restituisce il seguente errore:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error",
}
],
"code": 400,
"message": "Parse Error"
}
}
Per ulteriori test, puoi raccogliere informazioni dal tuo dispositivo utilizzando i seguenti SDK e API:
Descrizioni degli errori
Di seguito sono riportati i possibili errori che potresti riscontrare, con le relative descrizioni.
Motivo |
Dominio |
Codice di stato HTTP |
Descrizione |
dailyLimitExceeded |
usageLimits |
403 |
Hai superato il tuo limite giornaliero. |
keyInvalid |
usageLimits |
400 |
La chiave API non è valida per l'API Geolocation. Assicurati
di includere l'intera chiave e di aver acquistato l'API
o di aver abilitato la fatturazione e attivato l'API
per ottenere la quota senza costi. |
userRateLimitExceeded |
usageLimits |
403 |
Hai superato il limite di richieste che hai configurato nella console Google Cloud.
Questo limite viene in genere impostato come richieste al giorno, richieste ogni 100 secondi e richieste ogni 100 secondi per utente. Devi configurare il limite
per impedire a un singolo utente o a un piccolo gruppo di utenti di esaurire la quota giornaliera,
consentendo comunque un accesso ragionevole a tutti gli utenti.
Consulta Limitazione dell'utilizzo dell'API
per configurare questi limiti.
|
notFound |
geolocation |
404 |
La richiesta era valida, ma non è stato restituito alcun risultato. |
parseError |
global |
400 |
Il corpo della richiesta non è un JSON valido. Per informazioni dettagliate su ciascun campo, consulta la sezione
Corpo della richiesta. |
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-08-31 UTC.
[null,null,["Ultimo aggiornamento 2025-08-31 UTC."],[[["\u003cp\u003eThe Geolocation API uses IP addresses, WiFi points, and cell towers to determine location, with large accuracy radius often indicating IP-based geolocation.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting involves examining the error response, which includes an error code, message, and a list of errors with reasons and descriptions.\u003c/p\u003e\n"],["\u003cp\u003eYou can gather additional testing information from devices using the Android Location APIs, Places SDK for Android and iOS.\u003c/p\u003e\n"],["\u003cp\u003ePossible errors include exceeding daily or user request limits, using an invalid API key, and requests returning no results despite being valid.\u003c/p\u003e\n"]]],["If a large accuracy radius is shown, the service may be using the request IP instead of cell towers or WiFi. Test by setting `considerIp` to false; a 404 response confirms no access points were found. Error responses include a `code` (HTTP status), `message`, and an `errors` list with `reason` and `message`. Common errors include `dailyLimitExceeded` (403), `keyInvalid` (400), `userRateLimitExceeded` (403), `notFound` (404), and `parseError` (400) due to invalid JSON.\n"],null,["# Troubleshoot\n\nHere are some tips on troubleshooting common issues.\n\nWhy is the accuracy radius very large?\n--------------------------------------\n\nIf your Geolocation response shows a very high value in the accuracy field, the\nservice may be geolocating based on the request IP, instead of WiFi points or\ncell towers. These kinds of responses can happen if the service does not\nrecognize any cell towers or access points.\n\nTo confirm that the service could not geolocate your access points, set\n`considerIp` to false in your request. If the response is a 404, you've\nconfirmed that your wifiAccessPoints and cellTowers objects could not be geolocated.\n\nHow do I troubleshoot a response error?\n---------------------------------------\n\nIf your request generates an error, the system returns a standard format error\nresponse body and sets the HTTP status code to an error status.\n\nThe error response contains an object with a single error object with the\nfollowing keys:\n\n- `code`: This is the same as the HTTP status of the response.\n- `message`: A short description of the error.\n- `errors`: A list of errors that occurred. Each error contains an identifier for the type of error (the reason) and a short description (the message).\n\nFor example, sending invalid JSON returns the following error: \n\n {\n \"error\": {\n \"errors\": [\n {\n \"domain\": \"global\",\n \"reason\": \"parseError\",\n \"message\": \"Parse Error\",\n }\n ],\n \"code\": 400,\n \"message\": \"Parse Error\"\n }\n }\n\nGather testing information from devices\n---------------------------------------\n\nFor additional testing, you can gather information from your device using the\nfollowing SDKs and APIs:\n\n- **Android devices** : Go to [Places SDK for Android](/maps/documentation/places/android-sdk/current-place), and [Android\n Location APIs](https://developer.android.com/training/location/index.html).\n\n- **iOS devices** : Go to [Places SDK for iOS](/maps/documentation/places/ios-sdk/current-place).\n\nError descriptions\n------------------\n\nHere are the possible errors you might encounter with descriptions.\n\n| Reason | Domain | HTTP Status Code | Description |\n|-------------------------|---------------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `dailyLimitExceeded` | `usageLimits` | 403 | You have exceeded your [daily limit](/maps/documentation/geolocation/usage-and-billing#other-usage-limits). |\n| `keyInvalid` | `usageLimits` | 400 | Your API key is not valid for the Geolocation API. Be sure to include the entire key, and that you've either purchased the API or have [enabled billing and activated the API](/maps/documentation/geolocation/get-api-key) to obtain the quota at no charge. |\n| `userRateLimitExceeded` | `usageLimits` | 403 | You have exceeded the request limit that you configured in the Google Cloud console. This limit is typically set as requests per day, requests per 100 seconds, and requests per 100 seconds per user. You should configure your limit to prevent a single or small group of users from exhausting your daily quota, while still allowing reasonable access to all users. See [Capping API Usage](https://cloud.google.com/apis/docs/capping-api-usage) to configure these limits. |\n| `notFound` | `geolocation` | 404 | The request was valid, but no results were returned. |\n| `parseError` | `global` | 400 | The request body is not valid JSON. Refer to the [Request Body](/maps/documentation/geolocation/requests-geolocation#body) section for details on each field. |"]]