I have an Android App which copies a spreadsheet, edit the spreadsheet and upload some photos to a third person Google Drive Account, using a service account.
The App was working OK. But the last 22nd of January, the App started to fail.
Now it copies the spreadsheet and edit, but the photos are no longer uploaded. And I'm receiving this error.
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{re
"code" : 403,
"errors" : [ {
"domain" : "usageLimits",
"message" : "The user has exceeded their Drive storage quota",
"reason" : "quotaExceeded"
} ],
"message" : "The user has exceeded their Drive storage quota"
}
I have checked both the API quota and the Drive storage quota and they are quite lower than the limit.
I have not made changes in the code and I have not changed the security settings in any of the involved accounts.
I could not find any known issue about this.
Is anyone else experiencing something similar??
I found the problem and a candidate solution.
This is the scenario:
When worker@gmail.com takes a photo, the service@gmail.com uploads a photo to the manager@gmail.com Google Drive. But the owner of the photo is the service@gmail.com. So in the manager@gmail.com Google Drive, you can see all the photos, but the quota always remains to zero.
After uploading 15 GB o photos I actually exceeded the quota, but it was the quota of the service@gmail.com (which is not visible in Google Drive).
SOLUTIONS
Log into the manager@gmail.com Google Drive and delete the photos.
Log into the service@gmail.com Google Drive and delete the photos.
Transfer the ownership of the files from service@gmail.com to manager@gmail.com.
DIRTY SOLUTION
Yep, this may not be the most elegant solution. But it worked for me.
I created a Google Script using the manager@gmail.com account and I published as a Public Web Application.
This methods receives the fileId created by the service@gmail.com, makes a copy (which owns manager@gmail.com). I need to remove the the file created by the service@gmail.com. The file is actually not removed, but it is not linked any more to the one created by the manager@gmail.com. Finally it returns the new fileId.
Now, my Android App looks like this:
The dirty solution works, but it is very dirty. I could not figure out other way to work around this.