CloudStorageUtil - An Android library to make sync on Google Cloud Storage easier

Overview

gCloud Storage Utils

An Android library to make sync on Google Cloud Storage easier. Currently it only supports image uploads.

Installation

implementation "com.evolve:gcloud-storage-utils:1.0.2"

Usage

val gcsMetaData = GCSMetaInfo.Builder().apply { bucketName = Constants.BUCKET_NAME // GCS google cloud buckey serviceConfig = assets.open(Constants.SERVER_KEY) // GCS auth config file. this.gcsStoragePath = getGCSStoragePath() imageMetaInfo = GCSMetaInfo.ImageMetaInfo().apply { this.imagePath = "image path" this.mediaType ="media type" //GCSMetaInfo.ImageMetaInfo.TYPE_JPEG this.metadata = imageExtraParams.toString() compressLevel = 80 ("Compression ratio") // default value is 100 compressFormat = Bitmap.CompressFormat.JPEG //default value is Bitmap.CompressFormat.PNG waterMarkInfo= // default value is null , GCSMetaInfo.WaterMarkInfo.EMPTY() } }.build() return@flatMap uploadImageGCS(gcsMetaData) } .doOnNext { print("next on call $it") } .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) .subscribe({ println("Progress: $it") }, { println("Image error: ${it.localizedMessage}") println("image error stacktrace: ${it.printStackTrace()}:") progressBar.visibility = View.GONE }, { println("completed") progressBar.visibility = View.GONE }) // consume the request object as you wish to">
// build the `AuthInfo` for upload 
val list = mutableListOf<String>()
        list.add("Url 1")
        list.add("Url 2")
        list.add("Url 3")
        var disposable = Flowable.fromIterable(list)
                .flatMap { count ->
                    val gcsMetaData = GCSMetaInfo.Builder().apply {
                        bucketName = Constants.BUCKET_NAME // GCS google cloud buckey
                        serviceConfig = assets.open(Constants.SERVER_KEY)  // GCS auth config file.
                        this.gcsStoragePath = getGCSStoragePath()
                        imageMetaInfo = GCSMetaInfo.ImageMetaInfo().apply {
                            this.imagePath = "image path"
                            this.mediaType ="media type" //GCSMetaInfo.ImageMetaInfo.TYPE_JPEG
                            this.metadata = imageExtraParams.toString()
                            compressLevel = 80 ("Compression ratio") // default value is 100
                            compressFormat = Bitmap.CompressFormat.JPEG //default value is Bitmap.CompressFormat.PNG
                            waterMarkInfo= // default value is null , GCSMetaInfo.WaterMarkInfo.EMPTY()
                        }
                    }.build()
                    return@flatMap uploadImageGCS(gcsMetaData)
                }
                .doOnNext {
                    print("next on call $it")
                }
                .subscribeOn(Schedulers.computation())
                .observeOn(AndroidSchedulers.mainThread())

                .subscribe({
                    println("Progress: $it")

                }, {
                    println("Image error: ${it.localizedMessage}")
                    println("image error stacktrace: ${it.printStackTrace()}:")
                    progressBar.visibility = View.GONE
                }, {
                    println("completed")
                    progressBar.visibility = View.GONE
                })
    
// consume the request object as you wish to

Have a look at the sample code included in the project as well.

You might also like...
Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

A robust native library loader for Android.
A robust native library loader for Android.

ReLinker A robust native library loader for Android. More information can be found in our blog post Min SDK: 9 JavaDoc Overview The Android PackageMan

Joda-Time library with Android specialization

joda-time-android This library is a version of Joda-Time built with Android in mind. Why Joda-Time? Android has built-in date and time handling - why

UPnP/DLNA library for Java and Android

Cling EOL: This project is no longer actively maintained, code may be outdated. If you are interested in maintaining and developing this project, comm

:iphone: [Android Library] Get device information in a super easy way.
:iphone: [Android Library] Get device information in a super easy way.

EasyDeviceInfo Android library to get device information in a super easy way. The library is built for simplicity and approachability. It not only eli

Android library for viewing, editing and sharing in app databases.
Android library for viewing, editing and sharing in app databases.

DbInspector DbInspector provides a simple way to view the contents of the in-app database for debugging purposes. There is no need to pull the databas

Android Market In-app Billing Library

Update In-app Billing v2 API is deprecated and will be shut down in January 2015. This library was developed for v2 a long time ago. If your app is st

An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt
An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt

Motion An Android library allowing images to exhibit a parallax effect. By replacing static pictures and backgrounds with a fluid images that reacts t

Android library to easily serialize and cache your objects to disk using key/value pairs.

Deprecated This project is no longer maintained. No new issues or pull requests will be accepted. You can still use the source or fork the project to

Releases(2.0.0)
Owner
Evolve Asia
Evolve Asia
A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the same idea as requireContext, requireArguments, and other similar Android SDK methods.

Márton Braun 82 Oct 1, 2022
Useful helpers that make it easier to implement maven-plugin mojos with kotlin

A library that makes writing powerful maven plugins even easier by providing kotlin extensions and convenience functions for common use cases.

TOOListicon 1 Nov 4, 2022
✔️ Secure, simple key-value storage for Android

Hawk 2.0 Secure, simple key-value storage for android Important Note This version has no backward compatibility with Hawk 1+ versions. If you still wa

Orhan Obut 3.9k Dec 20, 2022
ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions

ModernStorage ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions by apps dev

Google 1.1k Dec 30, 2022
KmmCaching - An application that illustrates fetching data from remote data source and caching it in local storage

An application that illustrates fetching data from remote data source and caching it in local storage for both IOS and Android platforms using Kotlin Multiplatform Mobile and SqlDelight.

Felix Kariuki 5 Oct 6, 2022
XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them.

XClipper XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them ❤️

Kaustubh Patange 134 Dec 31, 2022
Utility tool to make you a computer ninja.

Cmd Window Never spend 6 minutes doing something by hand when you can spend 6 hours failing to automate it - Zhuowej Zhang What is this about? This to

Marcin Radoszewski 3 Feb 1, 2022
📃 Turn Google Spreadsheet to JSON endpoint (for Android and JVM) for FREE (100%)

retrosheet ?? Turn Google Spreadsheet to JSON endpoint. [For Android and JVM]. Benefits ?? No worries about server health (because you're using Google

Sifar 687 Jan 4, 2023
An app full of Constantly updating Google Pixel wallpapers

An app full of Stock Google Pixel wallpapers! Download: Found a Wallpaper not on the app? Submit and issue to the Google Pixel Wallpaper repository Sc

Jack Sam 118 Dec 25, 2022
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021