Accessing Google Drive on Android without device account registration

I’m working on an Android app that needs to let users access their Google Drive files. The tricky part is it’s for public devices, so we can’t add everyone’s Google account to the device.

The official docs all show how to do this with a registered account, but that won’t work for us. When you try to connect, it shows a popup to pick an account on the device or add a new one.

Here’s what I’m after:

  • Let users log into their Drive without saving the account
  • Read and write their files
  • Log out when done, leaving no personal info behind

Anyone know how to pull this off? I’ve been banging my head against the wall trying to figure out a workaround. Any ideas would be super helpful!

I’ve actually faced a similar challenge in a kiosk app project. What worked for us was using the Google Sign-In API with a custom web-based flow. We created a WebView in the app that loaded Google’s OAuth page. This let users log in without saving anything to the device.

For file operations, we used the Google Drive REST API with the access token from the sign-in process. Everything stayed in memory - no disk writes. When the user was done, we’d clear all data and invalidate the token.

It took some work to set up, but it gave us the security and privacy we needed for public devices. Just make sure you handle error cases well, like network issues during auth. And definitely test thoroughly with different Google account types.

have u tried using OAuth 2.0 for this? it lets users grant temporary access without adding accounts to the device. you’d need to implement the auth flow yourself, but it should work for wat ur trying to do. just make sure to clear tokens when logging out. hope that helps!

One approach you might consider is implementing a web-based authentication flow. This would involve opening a WebView within your app to handle the Google sign-in process. Users could log in through this interface without adding their account to the device.

After successful authentication, you’d receive an access token to interact with the Google Drive API. Store this token securely in memory, not on disk. When the user is done, clear the token and any cached data.

This method maintains privacy on shared devices while still allowing file access. It does require more custom implementation, but it should meet your requirements for temporary access without account registration.