我正在使用新的Google云端硬盘Android API.这是我从Google的android-samples repo中复制的演示代码.
GoogleSignInAccount signInAccount = GoogleSignIn.getLastSignedInAccount(this);
if (signInAccount != null && signInAccount.getGrantedScopes().containsAll(requiredScopes)) {
initializeDriveClient(signInAccount);
}
else
{ ... }
Run Code Online (Sandbox Code Playgroud)
我面临的问题是,即使我从云端硬盘删除应用程序,getLastSignedInAccount()仍然会返回帐户,并且帐户上的操作(例如添加文件)仍然成功.GoogleSignInAccount我想,返回对象很好,但它不应该允许对它进行操作.我在Drive中双重检查,当API返回成功时没有添加任何文件(因为我已取消链接应用程序).这里出了什么问题?
是的,当我手动同步我的设备上的帐户时,它工作正常.在这种情况下,虽然getLastSignedInAccount()返回了对象,但操作确实失败了.
PS:我在请求SCOPE_FILE和SCOPE_APPFOLDER范围.
android authorization google-play-services google-drive-android-api