0

I have a working solution where I search for files in Google Drive and ask for Google Drive to open them using the getWebViewLink, this generates a link like this:

https://drive.google.com/file/d/0B6cgfp1Py-7SAF&SAFgASFGZGlQWEU/view?usp=drivesdk

Then I parse the link and generate an intent like this:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
startActivity(intent);

This works great on devices configured with one gmail account, but if the device happens to have 2 or more gmail accounts configured then Google Drive keeps always asking which account the user wants to use to open the file.

Is there anyway to suggest in the link which account to use to Google Drive?

P.S: I tried adding the following to the link to no avail

&approval_prompt=auto

or

&user_id=myemail@gmail.com
Kara
  • 6,115
  • 16
  • 50
  • 57
Steve
  • 427
  • 4
  • 14

1 Answers1

0

You may refer with this related thread. It stated that the redirect loop happens to users that have both a Gmail account and a Google Apps account. There are only one set of active Docs cookies at any given time. The workarounds are to either log out of the account that you are not currently trying to use for Docs access or use different browsers for each account.

Here's another reference which might help: How can I enforce GoogleApiClient to prompt account chooser UI each time I call connect?

...you must manage the account selection yourself as you can see here (for REST) or here (for GDAA)

Hope this helps!

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59