i am implementing Google Drive in Android with Java code i didnt use Android formats,
i just created client id and i used in Manifest
<meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="id=344123456789"/>
and my code to create folder is
credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(DriveScopes.DRIVE));
credential.setSelectedAccountName(accountName);
service = getDriveService(credential);
java.io.File fileContent = new java.io.File(path);
FileContent mediaContent = new FileContent("image/jpeg", fileContent);
File fileMetadata = new File();
fileMetadata.setName("Invoices");
fileMetadata.setMimeType("application/vnd.google-apps.folder");
File file = UploadPicture.service.files().create(fileMetadata)
.setFields("id")
.execute();
i am implementing Google Drive in Android with Java code i didnt use Android formats,
i just created client id and i used in Manifest
<meta-data android:name="com.google.android.apps.drive.APP_ID" android:value="id=344123456789"/>
and my code to create folder is
credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(DriveScopes.DRIVE));
credential.setSelectedAccountName(accountName);
service = getDriveService(credential);
java.io.File fileContent = new java.io.File(path);
FileContent mediaContent = new FileContent("image/jpeg", fileContent);
File fileMetadata = new File();
fileMetadata.setName("Invoices");
fileMetadata.setMimeType("application/vnd.google-apps.folder");
File file = UploadPicture.service.files().create(fileMetadata)
.setFields("id")
.execute();
this is my code to create folder, but if i am using it from Activity it works but i am using fragments so i got UserRecoverableAuth exception please anyone help me. Thanks in advance