Shailendra Kushwah
Shailendra Kushwah

Reputation: 415

how to uploading image from android device to Google cloud storage?

I developed an android app which use Google app engine as a server and it works fine . Now i want to upload image from my device to google cloud storage and retrieve from storage to my device. I had read many blogs on internet about google cloud storage and data store but i am not getting how it can be implemented in android.

Upvotes: 1

Views: 1379

Answers (2)

Lalit Rane
Lalit Rane

Reputation: 890

You can choose Google Cloud Storage or Firebase. For both products, Google gives client libraries for Java Clients.

I find firebase easy and more intuitive to use. You can build the solution faster and better with Firebase.

I faced issues while using Google Cloud Storage APIs and worst, in my experience no one replies to your queries when you post queries about Google Cloud Storage. Support for Google Cloud Storage is absolutely pathetic compared to what I have seen for AWS or Cloudinary. You will experience better developer support for Firebase too.

On the flip side, at present Firebase is costlier than Google Cloud Storage.

Upvotes: 0

Jeffrey Godwyll
Jeffrey Godwyll

Reputation: 3893

For android, it's recommended that you use Firebase Storage to ease the process.

Firebase Storage stores your files in a Google Cloud Storage bucket shared with the default Google App Engine app, making them accessible through both Firebase and Google Cloud APIs.

Implementation path:

  1. Integrate the Firebase Storage SDKs. Quickly include clients via Gradle, CocoaPods, or a script include.

  2. Create a Reference. Reference the path to a file, such as "images/mountains.png", to upload, download, or delete it.

  3. Upload or Download. Upload or download to native types in memory or on disk.

  4. Secure your Files. Use Firebase Storage Security Rules to secure your files.

Example:

StorageReference mStorageRef = FirebaseStorage.getInstance().reference().child("cloudstorage/path/to/file.jpg");
Uri file = Uri.fromFile(new File("local/path/to/file.jpg"));
UploadTask uploadTask = mStorageRef.putFile(file);

Find more in this sample.

Upvotes: 1

Related Questions