当我应该断开Goog​​leApiClient(安卓) [英] When should I disconnect GoogleApiClient (Android)

查看:220
本文介绍了当我应该断开Goog​​leApiClient(安卓)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我有3个登录选项。 Google+的,Facebook和我自己的登录选项。我实现了所有3。

In my android app, I have 3 login options. Google+, Facebook, and my own login option. I've implemented all 3.

我实现了使用这里列出步骤Google+的登录。 服务器端访问启用。

I've implemented Google+ login using the steps outlined here. Server side access is enabled.

我得到的一次性授权code和它传递给我自己的API。一旦我收到的授权code,有什么理由继续GoogleApiClient连接?

I get the one time authorization code and pass it to my own api. Once I've received the authorization code, is there any reason to keep GoogleApiClient connected?

我对Facebook的会议<一个类似的问题href="http://stackoverflow.com/questions/30044339/when-should-i-close-facebook-session-android">here.

I have a similar question for Facebook Session here.

推荐答案

没有理由保持连接到GoogleApiClient除非你打算直接调用其API中的一个版本。一旦你的授权code,可以关闭GoogleApiClient,如果你想要的。

There is no reason to keep connected to the GoogleApiClient unless you plan on directly calling one of its APIs later. Once you have the authorization code, you can close the GoogleApiClient if you want.

这是什么做这个早帮你吗?它清除粘合剂连接早一些,并允许com.google.android.gms过程从内存中清除(它可能不会从内存反正反正在中到高端手机中删除了一会儿)位更早。

What does doing this early get you? It clears a binder connection a bit earlier and allows the com.google.android.gms process to be removed from memory (it probably won't be removed from memory anyway for a while anyway on mid-to-high end phones) a bit sooner.

我不担心这一点。只要你的活动#的onStop年底前关闭GoogleApiClient 一切都应该罚款。

I wouldn't worry about this. As long as you close the GoogleApiClient before the end of Activity#onStop everything should be fine.

这篇关于当我应该断开Goog​​leApiClient(安卓)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆