管理 Play 游戏服务 API 用量
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本主题介绍了如何在游戏中检测和管理 Play 游戏服务 API 用量。
检测调用频率限制
如果您使用的是 Play 游戏服务 SDK,当游戏超出调用频率限制时,回调处理程序或监听器会返回错误。
在 Android 中,返回 PendingResult
对象的调用(例如 incrementAchievementImmediate
)会在结果对象中返回 STATUS_NETWORK_ERROR_OPERATION_DEFERRED
状态代码。此状态代码表示,当游戏不再受到调用频率限制时,库将自动尝试再次发出调用。
如需为您的游戏申请更多配额,请参阅增加配额部分。
管理每日配额
您可以在 Google Cloud Platform 中访问项目,查看应用在 Google Cloud Platform 上的每日配额。
如需查看或更改项目的用量限额,或申请增加配额,请执行以下操作:
- 如果您的项目还没有结算账号,请创建一个。
- 在 API 控制台中访问 API 库中的“已启用的 API”页面,然后从列表中选择一个 API。
- 如需查看和更改配额相关设置,请选择配额。如需查看使用量统计信息,请选择使用量。
您可以设置用户每秒可以发出的调用次数上限,以确保存在滥用行为的玩家不会用尽应用的所有配额。如需详细了解用量上限,请参阅 Google Cloud Platform 文档。
如需为您的游戏申请更多配额,请参阅增加配额部分。
申请增加配额
如需申请增加游戏配额,请在 Google Cloud Platform 中点击应用配额条目旁边的“申请更高配额”链接。
除非游戏的配额用量出现异常,且遵循了质量核对清单中的最佳实践,否则通常不会接受申请增加游戏配额的请求。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# Manage Play Games Services API usage\n\nThis topic describes how to detect and manage Play Games Services API usage in\nyour game.\n\nDetect rate limiting\n--------------------\n\nIf you are using the Play Games Services SDK, your callback handlers or listeners\nreturn errors when your game exceeds its rate limit.\n\nIn Android, calls that return\n[`PendingResult`](https://developer.android.com/reference/com/google/android/gms/common/api/PendingResult.html)\nobjects,\nsuch as\n[`incrementAchievementImmediate`](https://developer.android.com/reference/com/google/android/gms/games/achievement/Achievements.html#incrementImmediate(com.google.android.gms.common.api.GoogleApiClient,%20java.lang.String,%20int)),\nreturn a `STATUS_NETWORK_ERROR_OPERATION_DEFERRED` status code in the\nresult object. This status code indicates that the library will automatically\nattempt to make the call again later when your game is no longer rate limited.\n\nTo request additional quota for your games, see the\n[quota increase](#quota-increase) section.\n\nManage your daily quota\n-----------------------\n\nYou can review your application's daily quota for Google Cloud Platform by\nvisiting your project in the\n[Google Cloud Platform](https://console.developers.google.com/).\n\nTo view or change usage limits for your project, or to request an increase to\nyour quota, do the following:\n\n1. If you don't already have a [billing account](//cloud.google.com/billing/docs/how-to/manage-billing-account) for your project, then create one.\n2. [Visit the Enabled APIs page of the\n API library](https://console.cloud.google.com/apis/enabled) in the API Console, and select an API from the list.\n3. To view and change quota-related settings, select **Quotas** . To view usage statistics, select **Usage**.\n\nYou can set the maximum number of calls a user can make per second, to\nhelp ensure that an abusive player doesn't use up all of your application's\nquota. To learn more about capping usage, see the\nGoogle Cloud Platform\n[documentation](https://developers.google.com/console/help/capping-usage).\n\nTo request additional quota for your games, see the\n[quota increase](#quota-increase) section.\n\nRequest a quota increase\n------------------------\n\nTo request a game quota increase, click the *Request more* link next to\nyour app's quota entry in the\n[Google Cloud Platform](https://console.developers.google.com/).\n\nRequests to increase the games quota usually aren't accepted unless your game is\nexperiencing exceptional usage and is obeying the best practices in the\n[quality checklist](https://developers.google.com/games/services/bestpractices#9_quota_and_rate_limiting)."]]