1
votes

i am using Android with google app engine endpoints backend storing data with datastore. Now i want to add and store user images. What is the best way to integrate Google cloud storage:

  1. create an new endpoint with blobs in the api and call cloud storage from the endpoint? Android -->--> App Engine Endpoint --> Google Cloud Storage Google Cloud Storage --> App Engine Endpoint --> -->Android

  2. Directly call Google cloud storage from Android device without endpoint? Android --> --> Google Cloud Storage

  3. Better alternative?

Thanks!

1

1 Answers

1
votes

Your option 1 would only work if you the image was under 1MB because that is the maximum size in datastore for a base64 encoded string (which is what you would pass to your endpoint method)

Your option 2 I would not recommend because then you would be storing service account keys to GCS straight in the client, and that would not be secure (unless you didn't care).

Option 3 is what I did:

I have an Endpoints method that generates a signed url (or you can use resumable url). Signed urls are timed and expire. The object name and bucket are specified in the signed url. I call my endpoints method in Android to get the signed url and use an HttpURLConnection to upload the image to GCS.

Like me, you will probably want a callback method when your object uploads to GCS. This is a bit more complicated but you will need to create a servlet in your Endpoints project and handle accordingly. The documentation is very helpful for Object Change Notification.