Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 避免Google Drive Java REST API每次在具有多个帐户的设备上提示用户帐户_Android_Google Drive Api - Fatal编程技术网

Android 避免Google Drive Java REST API每次在具有多个帐户的设备上提示用户帐户

Android 避免Google Drive Java REST API每次在具有多个帐户的设备上提示用户帐户,android,google-drive-api,Android,Google Drive Api,我有一个工作解决方案,我在Google Drive中搜索文件,并要求Google Drive使用getWebViewLink打开它们,这会生成如下链接: https://drive.google.com/file/d/0B6cgfp1Py-7SAF&SAFgASFGZGlQWEU/view?usp=drivesdk Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link)); startActivity(intent)

我有一个工作解决方案,我在Google Drive中搜索文件,并要求Google Drive使用
getWebViewLink
打开它们,这会生成如下链接:

https://drive.google.com/file/d/0B6cgfp1Py-7SAF&SAFgASFGZGlQWEU/view?usp=drivesdk
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
startActivity(intent);
然后我解析链接并生成如下意图:

https://drive.google.com/file/d/0B6cgfp1Py-7SAF&SAFgASFGZGlQWEU/view?usp=drivesdk
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
startActivity(intent);
这在配置了一个gmail帐户的设备上非常有效,但是如果该设备碰巧配置了两个或更多gmail帐户,那么Google Drive会一直询问用户想要使用哪个帐户打开文件

在链接中是否有建议使用哪个帐户来Google Drive

附言:我试图在链接中添加以下内容,但没有效果

&approval_prompt=auto

你可以参考这个。它指出,重定向循环发生在同时拥有Gmail帐户和谷歌应用程序帐户的用户身上。在任何给定时间只有一组活动文档cookie。解决方法是注销当前不尝试用于文档访问的帐户,或者为每个帐户使用不同的浏览器

下面是另一个可能有帮助的参考:

…您必须自己管理您可以看到或看到的帐户选择

希望这有帮助