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