Eae*_*Eae 9 android google-play-games
public class MainActivity extends Activity implements GoogleApiClient.ConnectionCallbacks {
@Override
public void onConnectionSuspended(int i) {
Log.d(TAG, "onConnectionSuspended() called. Trying to reconnect.");
sendToast("onConnectionSuspended() called. Trying to reconnect.");
mGoogleApiClient.connect();
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
我已阅读文档:https: //developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html
根据我读到的内容,我做了一个简单的测试,我在快速游戏中连接了两个同伴.我在其中一个上禁用了WiFi连接.我以为我会看到onConnectionSuspended的祝酒词.有没有办法诱导吐司出于测试目的?
谢谢
Eug*_*nec 18
onConnectionSuspended当您的应用与Google Play服务包(不一定是互联网)断开连接时会被调用.例如,当您转到设置>应用> Google Play服务>强制停止时,将调用回调.另一个例子是您何时卸载Google Play服务.几秒钟之后你会得到onConnectionSuspended跟随onConnectionFailed(因为重新连接尝试会失败).
也不要打电话mGoogleApiClient.connect()从onConnectionSuspended(...).重新连接自动处理.
| 归档时间: |
|
| 查看次数: |
4162 次 |
| 最近记录: |