gpt4 book ai didi

android - Drive-API 上的 "onConnectionSuspended "何时被调用,如何处理?

转载 作者:行者123 更新时间:2023-11-29 01:21:31 29 4
gpt4 key购买 nike

Docs这么说:

public abstract void onConnectionSuspended (int cause)

Called when the client is temporarily in a disconnected state. This can happen if there is a problem with the remote service (e.g. a crash or resource problem causes it to be killed by the system). When called, all requests have been canceled and no outstanding listeners will be executed. GoogleApiClient will automatically attempt to restore the connection. Applications should disable UI components that require the service, and wait for a call to onConnected(Bundle) to re-enable them.

我不能让它发生,以便调查如何处理它。我试图断开与 Internet 的连接,但调用的不是回调(而是调用了 onConnectionFailed)。

当然它说我应该禁用 UI 组件,但它会被处理多长时间? “onConnected”会在不久之后被调用,并且总是在它之后被调用吗?

如果我创建一个所有目的都是连接到 Google Drive 的 Activity 怎么办?它应该在到达 onConnectionSuspended 时自行关闭吗?还是应该忽略它,一旦它会成功连接?

此外,因为它被称为“onConnectionSuspended”,是否意味着所有其他回调都是即时的?

最佳答案

您应该在调用 *onConnectionFailed* 之前获得 *onConnectionSuspended* 回调。 similar issue表示当您的应用在 Google Play 服务上断开连接时,将触发 onConnectionSuspended。 Google Play 服务的强制停止/终止可以触发回调,之后 - onConnectionFailed 接下来应该被调用。

关于android - Drive-API 上的 "onConnectionSuspended "何时被调用,如何处理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36542945/

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