简体   繁体   中英

Migrating from Blobstore to Google Cloud Storage for AppEngine Connected Android Project

I have an App Engine Connected Android Project. Presently I am using the Blobstore to store blobs. And here is how it works

  1. Android calls my App Engine server to request a servingUrl
  2. App Engine responds to the android client with the serving url
  3. Android loads the image (multipart) to the Blobstore using the aforementioned serving url
  4. The Blobstore makes a callback to App Engine (servlet) with BlobKey and whatever meta/extra data (ie multipart) that android sent to the Blobstore
  5. App engine stores the BlobKey in the Datastore. Or extract the url of the blob from the Blobkey and serve the blob that way.

    • unfortunately, you need a proper servlet to handle the callback from the Blobstore, as opposed to going all Cloud Endpoint

So in five steps and a note, I have told the world how to use App-Engine with the Blobstore with Android.

Will someone please provide similar steps for using together: App-Engine (datastore), Google Cloud Storage, and Android? Thanks. Preferably a solution that requires no "proper" servlet.

Please do distinguish between whether I should use the Google API Client Library or Google Cloud Client Library .

I am using Android Studio for development.

First of all, you have to think about who to authorize to upload the files: The user, or your app, or you android app.

If you authorize the users you have multiple options (authorize a certain google apps domain or certain users or use a signed url to upload the file to the bucket)

If you authorize the app (you app engine app does the authorization to upload blobs), you can upload directly to cloud storage, but in the same manner.

If you authorize your android app, you can get rid of the parts that app engine uploads you files, and write the code in your android app. For that you will need to use a service account that has permissions on a certain bucket in cloud storage.

Take a look at 1 , 2 , 3

Here is a sample that pushes messages to browser using pub/sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM