I\'m trying to set up an Android app that can manipulate files stored on my personal Google Drive account using the guidelines at Google Drive REST API Overview.
I\'
One thing I can think of is that the value of setSelectedAccountName
will default in to null
if no PREF_ACCOUNT_NAME
was retrieved, so this may contribute to the issue.
The only difference I can see that you did was how you instantiated the mCredential
. Try to check out the Authorizing requests for Android (using GoogleApiClient
instead of GoogleAccountCredential
.
You must be using the official Google Drive Api Quickstart by Google. Link. I can confirm that it doesn't work unfortunately as of now. It leads to an infinite login loop even if I have only one gmail account on my device. Maybe consider using the code at their Drive Api page as a starting point. That should work
I got the exact same problem, in my case the loop was due to the fact that I did not create my credentials for my app...
The details are described here: https://developers.google.com/drive/android/get-started
You must retrieve your SHA-1 keys for both the debug and production environments and add them in your credentials in the Google Developers Console as described in the guide.
Once I added these credentials, the loop stopped right away.