I successfully obtained an authentication token through AccountManager on Android for accessing Google Docs (writely service). However, I’m completely stuck on the next step - retrieving all documents belonging to the user.
I’ve seen various libraries mentioned like the Google-Api-Java-Client, but I’m really confused about how to implement them properly. I also looked at some sample applications including the picasa one, but they didn’t provide the clarity I needed.
Could someone please guide me on how to use the auth token to fetch the document list? Any code examples or step-by-step instructions would be greatly appreciated.
the docs api is pretty much outdated now. better to use drive api for this. setup your auth token, then call files().list() and filter by google docs mimetype. also, don’t forget to manage nextPageToken, or you might miss some docs if they have a ton.
I encountered this problem too. The Google Docs API alone isn’t sufficient; you must use the Drive API v3 to access documents. After obtaining your authentication token, construct a Drive service object and make your query from there. Google Docs are essentially Drive files differentiated by their mimeType. When querying the files endpoint, ensure to filter with “mimeType=‘application/vnd.google-apps.document’” to retrieve only Google Docs. Also, be mindful of pagination if the user has many documents, as the API handles results in batches.
I understand your struggle with the Google-Api-Java-Client documentation; it can be quite daunting. For tasks like listing user documents, I would recommend using the Google Drive API. First, authenticate and obtain your token, then create a Drive service instance. To fetch the document list, use the files().list() method and add a MIME type filter specifically for Google Docs. This makes it easier to identify and separate document files from other types. Start with a general file list before refining your search to troubleshoot any issues effectively.