Amazon Simple Storage Service is simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web.
Realtime Database Stores and sync app data in millisecondsFirebase Realtime Database Integrations
Gmail + Amazon S3Upload Files in Amazon S3 from new emails on Gmail [REQUIRED : Business Gmail Account] Read More...
Amazon Simple Storage Service (Amazon S3) is one of the best scalable, high-speed, web- based cloud storage service available today. Businesses around the world use this service to store and retrieve unlimited amount of data. This integration can simplify your email and file management by automatically saving your email attachments to Amazon S3 for safekeeping. Once you set up this Gmail-Amazon S3 integration, whenever you get a new email in Gmail with an attachment, Appy Pie Connect will save it to the Amazon S3 - just be sure to pick one when setting this up, otherwise we'll save all emails having an attachment.
It's easy to connect Amazon S3 + Firebase Realtime Database without coding knowledge. Start creating your own business flow.
Triggers when you add or update a file in a specific bucket. (The bucket must contain less than 10,000 total files.)
Triggers on updation of a child object in firebase realtime database.
New Child Object in a Firebase Realtime Database
Create a new Bucket
Creates a brand new text file from plain text content you specify.
Copy an already-existing file or attachment from the trigger service.
Creates or replaces a child object within your Firebase Realtime Database.
Amazon S3 is a reliable, inexpensive, and secure cloud storage. Amazon S3 offers a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web.
Amazon Simple Storage Service (Amazon S3. is an online storage web service offered by Amazon Web Services. It is designed to provide cloud storage through web services interfaces (REST, SOAP, BitTorrent.
Firebase is a mobile and web application development platform provided by Google. It was released in 2011 at Google I/O. Firebase is a NoSQL cloud database, so it does not require a traditional database server. It allows for real-time data synchronization between devices. Firebase stores data in JSON format, which makes it easier for developers to access their data from their mobile apps or web apps.
Both Amazon S3 and Firebase Realtime Database can be integrated with each other in the form of an app in order to improve the app's capabilities and to better serve the client's needs. By integrating these two services, we can create an app with the following features. Backup of files from phone to cloud storage, sync of files across devices and sharing of files in cloud storage with others.
i. Backup of Files from Phone to Cloud StorageThe first features of the app will be backup of all files stored in the app. We will implement this feature by integrating Amazon S3 and Firebase Realtime Database. First, we will need to select a folder in the phone's internal memory for storing all user files in the app. This folder will then be mapped to Amazon S3 using AWS SDK for Java. All files selected on the device will then be written to that folder and automatically backed up into Amazon S3. To ensure that all files are synchronized between devices, we will add a feature that enables users to manually backup the files on their device to Amazon S3. This feature will be added on the settings screen of the app. When a user selects this option, the app will automatically open up a file picker dialog box with the 'backup' folder as its root directory. All files present in that folder will be listed in a table view. If a file already exists on Amazon S3 with the same name as one being picked on the device, it will be skipped by the app. If no file with same name exists on Amazon S3, then that file will be uploaded to Amazon S3 using AWS SDK for Java. After all files have been backed up, the user will be presented with a confirmation dialog box. On clicking OK, the app will close itself and will return to home screen of the device.To backup all files from phone to cloud storage, we need to integrate Firebase Realtime Database and AWS SDK for Java in our app. We will create two classes for this purpose, namely FileManager (will contain a list of files in the 'backup' folder on device. and FileUploader (will contain methods needed to backup user files that are selected using file picker dialog box. We will define setOnClickListener(. method in our Activity class which will be called every time a user clicks on a file/folder in the internal memory of the device. We will then use this method to launch FilePickerDialog class which will pop up a dialog box with the 'backup' folder as its root directory. On clicking OK button in this dialog box, we will call uploadFiles(. method of FileUploader class which will then upload all selected files/folders to Amazon S3 using AWS SDK for Java. The code below shows how these methods are implemented in our app:The code below shows how AWS SDK for Java is integrated into our app:In order to integrate Firebase Realtime Database into our app, we need to first add Firebase/Google Play Services library into our app's project build path. To do this, we need to create a new project in Eclipse IDE called "Fb-Integration" by right clicking on 'Android' project in Package Explorer and selecting 'New > Android Application Project'. Then we need to select 'Create from existing source' option and browse for our app's source code folder from which we want to include Firebase/Google Play Services library. Once done, we can continue creating new project by selecting 'Next'. We can now select desired options like minimum SDK version, target SDK version etc. and then finish creating new project by clicking 'Finish'. For more details about how this is done please refer to Google's official documentation here .Once Firebase/Google Play Services library has been added into our app's project build path, we can start integrating Firebase Realtime Database into our app by creating a new class called DBManager (will contain methods needed to initialize and connect Firebase Realtime Database client. In order to initialize Firebase Realtime Database client , we need to add FirebaseConfig object into our app's main activity . Below is the code for adding FirebaseConfig object into main activity :The code below shows how Firebase config object is used to initialize Firebase Realtime Database client inside DBManager class :Now we are ready to start backing up all files from phone to cloud storage by integrating Firebase Realtime Database with AWS SDK for Java . The code below shows how this is done inside FileManager class :Here we are initializing AWS SDK for Java and passing it reference of our Firebase Realtime Database client . Once done, we can start writing code for uploading all files from internal memory of phone to Amazon S3 using AWS SDK for Java . The code below shows how this is done inside FileUploader class :Here we are initializing AWS SDK for Java and creating an instance of PutObjectRequest class . This class contains parameters needed to execute PUT request against Amazon S3 bucket . We also use putName(. method of PutObjectRequest class to specify name of file/folder which is being uploaded from device's internal memory to Amazon S3 bucket . Once all parameters have been set up, we need to call execute(. method of PutObjectRequest class which will open up an asynchronous HTTP connection with server that supports REST API calls . The response from server will then be logged into OutputStream object using streamOut(. method of HttpResponse class . Once response has been logged onto OutputStream object , it will automatically be printed out on LogCat console window (located under DDMS tab. The code below shows how initialization of PutObjectRequest object is done inside FileUploader class :Since asynchronous HTTP connections are opened up with server when execute(. method of PutObjectRequest class is called, there might be a possibility that another thread gets executed before the connection gets established with server. This may result in an exception saying "Error executing request". To avoid this exception , we need to make sure that another thread does not get executed until asynchronous HTTP connection gets established with server . We can do this by calling waitForConnection(. method of HttpClient class which blocks until asynchronous HTTP connection gets established with server . If another thread executes before connection gets established with server , then waitForConnection(. method throws an exception saying "oneway operation timeout". The code below shows how this is done inside FileUploader class :Here we are blocking execution of another thread until asynchronous HTTP connection gets established with server . Once connection gets established with server , we can proceed further by calling execute(. method of PutObjectRequest class which uploads selected file(s)/folder(s. from internal memory on device to Amazon S3 bucket using AWS SDK for Java . Then once all files have been uploaded successfully , we need to close down connection with server using close(. method of HttpClient object . To see how complete implementation looks like, refer to FileUploader class shown below:More details about using AWS SDK for Java are given in this tutorial here . Examples illustrating how integration of AWS SDK for Java and Firebase Realtime Database works are also given here .Below is sample output that is displayed on LogCat console window after clicking 'Backup' button in Settings screen of our app:Once backup has been completed successfully , a confirmation dialog box pops up saying "Backup Completed Successfully!". User can click 'OK' button in confirmation dialog box to close Settings screen and return back home screen. If user clicks 'Cancel' button instead , then Settings screen remains open and user has to manually close it using Back key on their device:As you can see above , dialog box closes itself after clicking 'OK' button on it . Dialog box looks like this
The process to integrate Amazon S3 and Firebase Realtime Database may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick solution to help you automate your workflows. Click on the button below to begin.