Google Firebase

Google Firebase

By | July 20th, 2018
No Comments on Google Firebase

Firebase gives you the tools to develop high-quality apps, grow your user

base, and earn more money. We cover the essentials, so you can monetize

your business and focus on your users. To add Firebase to your Android

Project, you need a device running Android 4.0 (Ice Cream Sandwich) or

newer, and Google Play services […]


Firebase gives you the tools to develop high-quality apps, grow your user base, and earn more money.
We cover the essentials, so you can monetize your business and focus on your users. To add Firebase to your Android Project, you need a device running Android 4.0 (Ice Cream Sandwich) or newer, and Google Play services 11.8.0 or higher.

Add Firebase to your app
If you’re using Android Studio version 2.2 or later, the Firebase Assistant is the simplest way to connect your app to Firebase. The Assistant can connect your existing project or create a new
one for you with all the necessary gradle dependencies.

To open the Firebase Assistant in Android Studio
• Click Tools > Firebase to open the Assistant window.
• Click to expand one of the listed features (for example, Analytics), then click the provided tutorial link (for example, Log an Analytics event).
• Click the Connect to Firebase button and add the necessary code to your app. That’s it!

Knowing a user’s identity allows an app to securely save user data in the cloud and provide a personalized experience across all of their devices. Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. It supports
authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook etc.Firebase Authentication integrates tightly with other Firebase services, and it leverages industry standards like OAuth 2.0 and OpenID Connect, so it can be easily integrated with your custom backend.

Key capabilities
FirebaseUI Auth
• Recommended way to add a complete sign-in system to your app.
• Provides a drop-in authentication solution that handles the UI flows for signing in users with email addresses and passwords, phone numbers, and with popular federated identity providers, including Google
and Facebook Login.
• Authentication component implements best practices for authentication on mobile devices and websites,
which can maximize sign-in and sign-up conversion for your app. It also handles edge cases like account
recovery and account linking that can be security sensitive and errorprone to handle correctly.
• FirebaseUI can be easily customized to fit in with the rest of your app’s visual style, and it is open source. Firebase Authentication SDK
• Authenticate users with their email addresses and passwords. Also handles sending password reset emails.
• Authenticate users by integrating with federated identity providers. like Google, Facebook, Twitter etc.
• SMS authentication.
• Connect your app’s existing sign-in system to the Firebase Authentication SDK and gain access to Firebase Realtime Database and other Firebase services.
• Use Firebase features that require authentication without making users sign in first by creating
temporary anonymous accounts. If the user chooses to sign up, you can upgrade the anonymous account to
a regular account, so the user can continue where they left off.

How to implement?
FirebaseUI Auth
1. Set up sign-in methods – For email address and password or phone number sign-in and any federated
identity providers you want to support, enable them in the Firebase console and complete any configuration required by the identity provider, such as setting your OAuth redirect URL.
2. Customize the sign-in UI – You can customize the sign-in UI by setting FirebaseUI options or fork the code on GitHub to customize the sign-in experience further.
3. Use FirebaseUI to perform the sign-in flow – Import the FirebaseUI library, specify the sign-in methods you want to support, and initiate the FirebaseUI sign-in flow. Firebase Authentication SDK
1. Set up sign-in methods – Follow the same steps as for FirebaseUI Auth.
2. Implement UI flows for your signin methods – For email address and password sign-in, implement a flow that prompts users to type their email addresses and passwords. For phone number sign-in, create a flow that prompts users for their phone number, and then for the code from the SMS message they receive. For federated sign-in, implement the flow required by each provider.
3. Pass the user’s credentials to the Firebase Authentication SDK – Pass the user’s email address and
password or the OAuth token that was acquired from the federated identity provider to the Firebase Authentication SDK.

It is a cloud-hosted NoSQL database. Data is stored as JSON and synchronized in Real Time to every connected client. When you build cross-platform apps with the iOS, Android, and JavaScript
SDKs, all clients share one Real Time Database instance and automatically receive updates with newest data.
This database also accomodates for your app growing in scale and popularity seamlessly

• Realtime – Instead of typical HTTP requests, the Firebase Realtime Database uses data synchronization—every time data changes, any connected device receives that update within milliseconds.
• Offline – Firebase apps remain responsive even when offline because the Firebase Realtime Database SDK persists your data to disk. Once connectivity is reestablished, the client device receives any changes it missed, synchronizing it with the current server state.
• Accessible from Client Devices – The Firebase Realtime Database can be accessed directly from a mobile device or web browser; there’s no need for an application server. Security
and data validation are available through the Firebase Realtime Database Security Rules, expression-based rules that are executed when data is read or written.
• Scale across multiple databases – With Firebase Realtime Database on the Blaze pricing plan, you can support your app’s data needs at scale by splitting your data across multiple database instances in the
same Firebase project. Streamline authentication with Firebase Authentication on your project and authenticate users across your database instances. Control access to the data in each database with custom Firebase Realtime Database Rules for each database instance.

How does it work?
The Firebase Realtime Database lets you build rich, collaborative applications with client side code being able to securely and directly access the database. Local data persistence is
maintained, and realtime events continue to fire even while offline, giving the end user a responsive experience. When the device regains connection, the Realtime Database synchronizes the local data changes with the remote updates that occurred while the client was offline, merging any conflicts

The Realtime Database provides a flexible, expression-based rules language, called Firebase Realtime
Database Security Rules, to define how your data should be structured and when data can be read from or written to. When integrated with Firebase Authentication, developers can define who has access to what data, and how they can access it.

The Realtime Database is a NoSQL database and as such has different optimizations and functionality compared to a relational database. The Realtime Database API is designed to only allow operations that can be executed quickly. This enables you to build a great realtime experience that can serve millions of users without compromising on responsiveness.

How to implement?
• Integrate the Firebase Realtime Database SDKs – Quickly include clients via Gradle, CocoaPods, or a
script include.
• Create Realtime Database References – Reference your JSON data, such as users/user:1234/phone number to set data or subscribe to data changes.
• Set Data and Listen for Changes – Use these references to write data or subscribe to changes.
• Enable Offline Persistence – Allow data to be written to the device’s local disk so it can be available offline.
• Secure your data – Use Firebase Realtime Database Security Rules to secure your data.

Cloud Storage for Firebase is a powerful, simple, and cost-effective object storage service built for Google scale. The Firebase SDKs for Cloud Storage add Google security to file uploads and downloads for your Firebase apps, regardless of network quality. You can use these SDKs to store images, audio, video, or other user-generated content. On the server, you can use Google Cloud Storage, to access the same files.

• Robust operations – Firebase SDKs for Cloud Storage perform uploads and downloads regardless of network quality. Uploads and downloads are robust, meaning they restart where they stopped.
• Strong security – Firebase SDKs for Cloud Storage integrate with Firebase Authentication. You can
use the declarative security model to allow access based on filename, size, content type, and other metadata.

• High scalability – Cloud Storage for Firebase is built for exabyte scale when your app grows in popularity. How does it work? Developers use the Firebase SDKs for Cloud Storage to upload and download
files directly from clients. If the network connection is poor, the client is able to retry the operation right where it left off, saving your users time and bandwidth. Cloud Storage stores your files in a Google Cloud Storage bucket, making them accessible through both Firebase
and Google Cloud. This allows you the flexibility to upload and download files from mobile clients via the Firebase SDKs and do server-side processing such as image filtering or video transcoding using Google Cloud Platform. Cloud Storage scales automatically, meaning that there’s no need
to migrate to any other provider. Learn more about all the benefits of the integration with Google Cloud Platform. The Firebase SDKs for Cloud Storage integrate seamlessly with Firebase Authentication to identify users, and we provide a declarative security language that lets you set access controls
on individual files or groups of files, so you can make files as public or private as you want.

How to implement?
• Integrate the Firebase SDKs for Cloud Storage – Quickly include clients via Gradle, CocoaPods, or a script include.
• Create a Reference – Reference the path to a file, such as “images/ mountains.png”, to upload, download, or delete it.
• Upload or Download – Upload or download to native types in memory or on disk.
• Secure your Files – Use Firebase Security Rules for Cloud Storage to secure your files.

Firebase Hosting is production-grade web content hosting for developers. With Hosting, you can quickly and easily deploy web apps and static content to a global content-delivery network (CDN) with a single command on your end.

• Served over a secure connection – The modern web is secure. Zero-configuration SSL is built into Firebase Hosting, so content is always delivered securely.
• Fast content delivery – Each file you upload is cached on SSDs at CDN edges around the world. No matter where your users are, the content is delivered fast.
• Rapid deployment – Using the Firebase CLI, you can get your app up and running in seconds. The
command line tools present make it easy to add deployment targets into your build process.
• One-click rollbacks – Quick deployments are great but being able to undo mistakes is even better. Firebase Hosting provides full versioning and release management with one-click rollbacks.

How does it work?
Firebase Hosting is built for the modern web developer. Static sites are more powerful than ever with the rise of front-end JavaScript frameworks like Angular and static generator tools like Jekyll. Whether you are deploying a simple app landing page or a complex Progressive Web App, Hosting gives you the infrastructure, features, and tooling tailored to deploying and managing static websites.Hosting gives your project a subdomain on the domain. Using the Firebase CLI, you can deploy files from local directories to your Hosting server. Files are served over an SSL connection from the closest edge server on the global CDN. In addition to static content hosting, Firebase Hosting offers lightweight configuration options for you to be able to build sophisticated Progressive Web Apps. You can easily rewrite URLs for clientside routing or set up custom headers for your app.
Once you’re ready to take a site to production, you can connect your own domain name to Firebase Hosting. We automatically provision an SSL certificate for your domain, so all your content is served securely.

How to implement?
• Install the Firebase CLI – The Firebase CLI makes it easy to set up a new Hosting project, run a local development server, and deploy content for the same.
• Set up a project directory – Add files for your web app and add your static assets to your local Hosting folder. You can then test your site locally by running firebase serve.
Deploy your site – When things are looking good, run firebase deploy to upload the latest snapshot to the servers. New versions are released all at once, so you’ll never have to worry about half-finished deployments. But, if something does go wrong, you can roll back with
one click any time.

Ashutosh Gupta
Share a little biographical information to fill out your profile. This may be shown publicly. In WordPress version 2.9, a new filter was added to make changing the [...] string in the excerpt. Do not use both of these methods in