Open Google Drive file with WebBrowser without show account selector

Having two Google accounts set up on a Android device, opening a Google Drive file (ex. https://drive.google.com/open?id=XXX) with WebBrowser shows a Google account selector.

If I open the same URI in the Samsung browser preinstalled on the device, or in Google Chrome, it doesn’t show the account selector.

How can I open the URI in an external browser or how can I configure ChromeCustomTabs to not display the account selector?

Has anyone else found it? Give me a hint, or something. Thanks in advance, brothers!

Regards,

The account chooser is of Google Drive… I guess that little can be done… Sorry for the turra.

This is based on the shared URL coming from Google Drive. The default shows the account chooser, but you may be able to adjust this behavior by modifying the URL. This link (https://www.lmeservices.com/share-google-drive-files-via-url/) has some explanation on how to adjust a file sharing URL to download a file directly. It might not fit your exact scenario, but there may be something similar you can do with the URL you’re using.

1 Like

@llamaluvr thx for your punctualization, bro; I have solved it by downloading the files from Google Drive through Expo FileSystem attacking the “uc” entry point of Google (https://drive.google.com/uc?id=${link}&export=download).

Then I open the documents with the package “rn-pdf-reader-js” (https://github.com/wiadev/rn-pdf-reader-js/archive/0.2.6.tar.gz) and everything seems to work fluently ^ _ ^

_openFile =  async (title, link, size, extension) => {
  const { t, navigation, connection } = this.props;
  const fileUrl   = `https://drive.google.com/uc?id=${link}&export=download`;
  const filePath  = `${FileSystem.documentDirectory}library/${link}.${extension}`;
  const file      = await FileSystem.getInfoAsync(filePath);
  
  if (!connection && !file.exists) {
    Toast.show({
      type: 'warning',
      position: 'top',
      text: t('library:unavailableDocument'),
      duration: 3000
    });
  }
  else if (file.exists && size == file.size) {
    navigation.navigate('DocumentViewer', { title, uri: filePath });
  }
  else {
    this.setState({ downloading: true });

    FileSystem.downloadAsync(fileUrl, filePath)
      .then(({ uri }) =>  {
        this.setState({ downloading: false });
        navigation.navigate('DocumentViewer', { title, uri });
      })
      .catch((error) => {
        this.setState({ downloading: false });
      });
  }
};

Thx bro…!

Regards,

1 Like