Comments (1)
Got the answer of this. using this code snippet we can make any folder or file public : anyone with link can access
`
private final Executor executor = Executors.newSingleThreadExecutor();
private void changePermissionSettings(String fileId) throws GeneralSecurityException, IOException, URISyntaxException {
JsonBatchCallback<Permission> callback = new JsonBatchCallback<com.google.api.services.drive.model.Permission>() {
@Override
public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) throws IOException {
Log.e("upload", "Permission Setting failed");
}
@Override
public void onSuccess(com.google.api.services.drive.model.Permission permission, HttpHeaders responseHeaders) throws IOException {
Log.e("upload", "Permission Setting success");
}
};
Tasks.call(executor, () -> {
BatchRequest batchRequest = googleDriveService.batch();
com.google.api.services.drive.model.Permission userPermission = new com.google.api.services.drive.model.Permission()
.setType("user")
.setRole("writer");
googleDriveService.permissions().create(fileId, userPermission)
.setFields("id")
.queue(batchRequest, callback);
com.google.api.services.drive.model.Permission contactPermission = new com.google.api.services.drive.model.Permission()
.setType("anyone")
.setRole("reader");
googleDriveService.permissions().create(fileId, contactPermission)
.setFields("id")
.queue(batchRequest, callback);
batchRequest.execute();
return "";
});
}
`
from android-samples.
Related Issues (20)
- Unable to Signin HOT 1
- Question: Google Drive API behavior post shut down HOT 4
- Question: Google Drive Application Specific Folder Deprecation HOT 7
- Get Specific drive folder 's list in Android HOT 1
- How to use Google Drive API in Android application? HOT 6
- Error after updating to new Gradle version HOT 6
- META-INF/DEPENDENCIES error HOT 1
- Deprecation Example - Sign In stuck HOT 5
- Image upload with folder example Not Given HOT 1
- Drive Access popup is not coming
- Solve Google Drive 401 error for Android release builds HOT 2
- App script sample HOT 1
- I got a headache when I was trying to figure out all these stuff
- How to configure sample for testing? HOT 2
- Displaying images
- Deprecated link in the README.md
- mDriveServiceHelper is always null
- 'call(java.util.concurrent.Executor, java.util.concurrent.Callable<TResult>)' is deprecated
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-samples.