I want to connect to Google Drive API in Android studio and create a file and read that file but I can not connect even though I have an apiKey. If I am debugging, then the application closes after GoogleApiClient.connect
. I have been researching various pages but some of them also take SHA1 fingerprints, is this necessary? What could I have done wrong?
Follow the setup from the Drive API Android Quickstart
You can create files in two ways with the Drive Android API: using the CreateFileActivityBuilder class, or using the createFile() method of the DriveFolder interface. The end result of either approach is the same. However, for instances where the user is specifying the location or title of the file, CreateFileActivityBuilder simplifies the process by providing a premade user interface. To create files programmatically or allow users to specify other metadata in a custom UI activity, you must use the the createFile() method.
Create a folder in the root folder
To create a folder, call DriveFolder.createFolder for the root folder. Pass the metadata containing the title and other attributes to set the values for the folder.
Create folder in Drive REST API
In the Drive API, a folder is essentially a file — one identified by the special folder MIME type application/vnd.google-apps.folder. You can create a new folder by inserting a file with this MIME type and a folder title. Do not include an extension when setting a folder title.