gpt4 book ai didi

android - 在 GCM 中,onError (Context context, String errorId) 中的错误 ID 是什么

转载 作者:搜寻专家 更新时间:2023-11-01 08:04:25 24 4
gpt4 key购买 nike

在 Android 的 GCM 示例中,示例 GCMIntentService 建议重写以下方法:

onError(Context context, String errorId): Called when the device tries to register or unregister, but GCM returned an error. Typically, there is nothing to be done other than evaluating the error (returned by errorId) and trying to fix the problem.

我的问题是,这个错误 ID 从何而来?例如,我如何确定错误是发生在注册还是注销时?

GCMBaseIntentService指定 errorId - GCM 服务返回的错误 ID 也没有太大帮助。

最佳答案

以下是 Google 指定的错误代码:

If the application request (be it register or unregister) fails, the error will be set with an error code, and the other extras will not be set. Here are the possible error codes:

SERVICE_NOT_AVAILABLE

The device can't read the response, or there was a 500/503 from the server that can be retried later. The Android application should use exponential back-off and retry. See Advanced Topics for more information.

ACCOUNT_MISSING

There is no Google account on the phone. The Android application should ask the user to open the account manager and add a Google account. Fix on the device side.

AUTHENTICATION_FAILED

Bad Google Account password. The Android application should ask the user to enter his/her Google Account password, and let the user retry manually later. Fix on the device side.

INVALID_SENDER

The sender account is not recognized. This must be fixed on the Android application side. The developer must fix the application to provide the right sender extra in the com.google.android.c2dm.intent.REGISTER intent.

PHONE_REGISTRATION_ERROR

Incorrect phone registration with Google. This phone doesn't currently support GCM.

INVALID_PARAMETERS

The request sent by the phone does not contain the expected parameters. This phone doesn't currently support GCM.

(引自 here )

关于android - 在 GCM 中,onError (Context context, String errorId) 中的错误 ID 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16471209/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com