Khắc phục sự cố
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Sau đây là một số mẹo khắc phục các vấn đề thường gặp.
Tại sao bán kính độ chính xác lại rất lớn?
Nếu phản hồi của Dịch vụ vị trí địa lý cho thấy một giá trị rất cao trong trường độ chính xác, thì dịch vụ có thể đang định vị địa lý dựa trên IP yêu cầu, thay vì các điểm truy cập Wi-Fi hoặc trạm phát sóng. Những loại phản hồi này có thể xảy ra nếu dịch vụ không nhận ra bất kỳ trạm phát sóng hoặc điểm truy cập nào.
Để xác nhận rằng dịch vụ không thể định vị địa lý các điểm truy cập của bạn, hãy đặt considerIp
thành false trong yêu cầu của bạn. Nếu phản hồi là 404, tức là bạn đã xác nhận rằng các đối tượng wifiAccessPoints và cellTowers không thể được định vị địa lý.
Làm cách nào để khắc phục lỗi phản hồi?
Nếu yêu cầu của bạn tạo ra lỗi, hệ thống sẽ trả về một nội dung phản hồi lỗi theo định dạng chuẩn và đặt mã trạng thái HTTP thành trạng thái lỗi.
Phản hồi lỗi chứa một đối tượng có một đối tượng lỗi duy nhất với các khoá sau:
code
: Giá trị này giống với trạng thái HTTP của phản hồi.
message
: Nội dung mô tả ngắn về lỗi.
errors
: Danh sách các lỗi đã xảy ra. Mỗi lỗi đều chứa một giá trị nhận dạng cho loại lỗi (lý do) và một nội dung mô tả ngắn (thông báo).
Ví dụ: việc gửi JSON không hợp lệ sẽ trả về lỗi sau:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error",
}
],
"code": 400,
"message": "Parse Error"
}
}
Để kiểm thử thêm, bạn có thể thu thập thông tin từ thiết bị của mình bằng cách sử dụng các SDK và API sau:
Nội dung mô tả lỗi
Dưới đây là những lỗi có thể xảy ra kèm theo nội dung mô tả.
Lý do |
Lâu đài |
Mã trạng thái HTTP |
Mô tả |
dailyLimitExceeded |
usageLimits |
403 |
Bạn đã vượt quá giới hạn hằng ngày. |
keyInvalid |
usageLimits |
400 |
Khoá API của bạn không hợp lệ đối với Geolocation API. Hãy nhớ thêm toàn bộ khoá và đảm bảo rằng bạn đã mua API hoặc đã bật tính năng thanh toán và kích hoạt API để nhận hạn mức miễn phí. |
userRateLimitExceeded |
usageLimits |
403 |
Bạn đã vượt quá giới hạn yêu cầu mà bạn đã định cấu hình trong bảng điều khiển Google Cloud.
Giới hạn này thường được đặt là số yêu cầu mỗi ngày, số yêu cầu mỗi 100 giây và số yêu cầu mỗi 100 giây cho mỗi người dùng. Bạn nên định cấu hình hạn mức để ngăn một người dùng hoặc một nhóm nhỏ người dùng sử dụng hết hạn mức hằng ngày, đồng thời vẫn cho phép tất cả người dùng truy cập một cách hợp lý.
Hãy xem phần Giới hạn mức sử dụng API để định cấu hình các giới hạn này.
|
notFound |
geolocation |
404 |
Yêu cầu hợp lệ nhưng không có kết quả nào được trả về. |
parseError |
global |
400 |
Nội dung yêu cầu không phải là JSON hợp lệ. Tham khảo phần Nội dung yêu cầu để biết thông tin chi tiết về từng trường. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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. |"]]