在GoogleapicLient保存(Android Drive SDK)中是访问令牌



我正在努力将Google Drive Android SDK集成到我的应用中,就像在演示应用程序中完成,我能够验证,列出条目等。我想知道是否是否在每次启动应用程序时,我都应该连接(( GoogleApiClient实例吗?

mGoogleApiClient = new GoogleApiClient.Builder(this)
    .addApi(Drive.API)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .addScope(Drive.SCOPE_APPFOLDER)
    .build();
 mGoogleApiClient.connect();

连接后我不应该获得OAuth2访问令牌,然后将其存储在应用程序启动会话之间。

您链接到使用Google Drive Android API的示例,这是一个离线API,可操纵设备上的驱动器文件。因此,没有oauth也没有访问令牌。Google Play Services会自动处理您的设备文件与Google Drive同步。

顺便说一句,存储访问令牌通常在一个小时后到期是没有意义的。

最新更新