Store files in google drive from Google App Engine - java

All,
I have a google application engine (java) that requires to store some images. I tried using Blobs and storing them in datastore but as you know there is a size limit on data that can be stored in datastore.
So as result I'm storing the images on a different server and store the path in my datastore and all works fine.
Now I'm thinking on using a google drive folder instead of using a server to upload the files to the drive and using the share link to display them later.
I've seen https://developers.google.com/drive/web/quickstart/java and got it to work fine. When I try to use it in my application however obviously this won't work as the code is assuming a credential for a local user.
I created a service key on my application and want to change the sample code above to use it but I'm not sure if that's the correct approach.
Tried searching for samples but can't find anyone that takes the same approach. Is there a working sample that shows how to authenticate an application not a user and let's say store a file in google drive?
I've also seen https://developers.google.com/drive/web/examples/ please note what I want is to store files in my google drive and not the user's google drive. So if user A and user B come to my app, they shouldn't have to authorize my application and should both be able to upload a file to my google drive.
I don't know if this can be done directly from their browser or I have to move the file to my application (appspot) and then push it to google drive.
Thanks

Related

Unable to access uploaded resources in Spring on Heroku [duplicate]

I've built an app where users can upload their avatars. I used the paperclip gem and everything works fine on my local machine. On Heroku everything works fine until server restart. Then every uploaded images disappear. Is it possible to keep them on the server?
Notice: I probably should use services such as Amazon S3 or Google Cloud. However each of those services require credit card or banking account information, even if you want to use a free mode. This is a small app just for my portfolio and I would rather avoid sending that information.
No, this isn't possible. Heroku's filesystem is ephemeral and there is no way to make it persistent. You will lose your uploads every time your dyno restarts.
You must use an off-site file storage service like Amazon S3 if you want to store files long-term.
(Technically you could store your images directly in your database, e.g. as a bytea in Postgres, but I strongly advise against that. It's not very efficient and then you have to worry about how to provide the saved files to the browser. Go with S3 or something similar.)

Get backup folder information using Google drive api

Is there any way to get Google drive backup folder information or the time when android device apps where last backed up?
I am making an android app which checks the last backup time
I believe that the backups are saved into an application data folder, an special hidden folder that saves application-specific files. Every application has one and can only be accessed by it. This means that you won't be able to access it with your application.
References
Store application-specific data (Google Drive API v3 guide)

How to access office local server files through an java swing app?

How to access office local server files through an java swing app?
I have an Java application made using Swing. Using this app I am taking data from user and storing it in a file.
Now, currently the data stored is being stored in user's system only. Now I have a local office server, I want to dynamically add data to that file whenever users inputs some data through that app, so that whenever i want to access that file, i can see all the users data that have been input through that app.
I have searched on net, but everywhere either FTP sever or cloud is being discussed and both are not allowed. How to tackle this problem ?

hosting the database file on any cloud service

I have an android application, which wants the user to login each time he runs the app. So, the login procedure is simple, using the sqlite dabase file i'm using. I've copied the file in assets folder and doing the necessary modifications. But, the database file is of no use unless it is on the server. I don't have any server so i'm thinkin of keeping the database file on dropbox, google drive etc and then read or update that file as per user commands. The question is how to do that? I was searching the web for it, and found that the only way is downloading the db file modifying it and the uploading it back. Can anyone give me an example??
Doing that isn't possible unless you have a server.
Because, if you are using dropbox, first you'll have to make your file public in order to download it (Not recommended at all. Compromises security). Then you can use the url to download the file. But you won't be able to upload it back (Unless you are able to login to dropbox through your Android code).
Instead if you a web server with MySQL n PHP, you can easily send POST requests to your server.

Creating files go to which account using Google Drive APIs when authenticating with a service account?

I'm trying to make use of the Google Drive APIs to send a log file created by our application to our company's Google Drive Account that we share for Android Development. Most of the examples showed how to use oAuth2 to authenticate with the end-user's Google Drive Account, but we want the files to be sent to just our Google Drive Account.
After some searching I found that I should create an API project for our app and use a Service account associated with that API Project to generate a key which we include in our project as a raw resource to authenticate using oAuth2 to get a GoogleCredential which is needed to build the Drive service we will use to make our API calls.
After authenticating properly, I was able to insert a file using the code example on the Google Drive API site and that appears to work properly, however I cannot see the file in our Google Drive account which created the API Project/Service account. Despite this, if I call Drive.files().list().execute() and output the FileList to a string I was able to see the files our app has previously inserted into the Service account's Google Drive.
So my question is: Is there a new Google Drive account created for the Service account that is separate from the Google Drive account that created the Service account? If so, is there a way to login to that account and view the files using the normal Google Drive Web UI so that we can get to the log files without writing some other application that authenticates with the Service account and then grabs the files?
It appears my question ended up being a duplicate, the other question one was just a little bit hard to find for me. The question is I can't see the files and folders created via code in my Google Drive and it was answered by a Google employee: https://stackoverflow.com/a/12218662/994519

Categories