Google Android ProjectA device running Android 4.0 (Ice

Google FirebaseFirebase 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.Add Firebase to Your Android ProjectA device running Android 4.0 (Ice Cream Sandwich) or newer, and Google Play services 11.8.0 or higherAdd Firebase to your appIf 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 to connect to Firebase and add the necessary code to your app.That’s it!Firebase AuthenticationMost apps need to know the identity of a user. Knowing a user’s identity allows an app to securely save user data in the cloud and provide the same personalized experience across all of the user’s 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 and Twitter, and more.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 capabilitiesFirebaseUI AuthThe recommended way to add a complete sign-in system to your app.FirebaseUI 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 Sign-In and Facebook Login.The FirebaseUI 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 error-prone 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, so you aren’t constrained in realizing the user experience you want.Firebase SDK AuthenticationAuthenticate users with their email addresses and passwords. The Firebase Authentication SDK provides methods to create and manage users that use their email addresses and passwords to sign in. Firebase Authentication also handles sending password reset emails.Authenticate users by integrating with federated identity providers. The Firebase Authentication SDK provides methods that allow users to sign in with their Google, Facebook, Twitter, and GitHub accounts.Authenticate users by sending SMS messages to their phones.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 requiring users to sign in first by creating temporary anonymous accounts. If the user later 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 AuthSet 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.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.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 SDKSet 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.Implement UI flows for your sign-in 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.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.Sign up users:1_sign_up_users.pngGet logged in users:2_get_logged_in_users.pngFirebase Realtime DatabaseStore and sync data with our NoSQL cloud database. Data is synced across all clients in Real Time and remains available when your app goes offline.It is a cloud-hosted database. Data is stored as JSON and synchronized in Real Time to every connected client. When you build cross-platform apps with our iOS, Android, and JavaScript SDKs, all of your clients share one Real Time Database instance and automatically receive updates with the newest data.Features: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. Provide collaborative and immersive experiences without thinking about networking code.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 by allowing secure access to the database directly from client-side code. Data is persisted locally, and even while offline, realtime events continue to fire, 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 automatically.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. Because of this, it is important to think about how users need to access your data and then structure it accordingly.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 while offline.Secure your data – Use Firebase Realtime Database Security Rules to secure your data.Read from database:3_read_from_database.pngCloud StorageCloud 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 our 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.Features: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, saving your users time and bandwidth.Strong security – Firebase SDKs for Cloud Storage integrate with Firebase Authentication to provide simple and intuitive authentication for developers. You can use our 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 goes viral. Effortlessly grow from prototype to production using the same infrastructure that powers Spotify and Google Photos.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 our 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.Read file data:4_storage.png5_read_file_data.pngDelete a file:6_delete_a_file.pngFirebase HostingFirebase 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.Features: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. Command line tools 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 on your computer to your Hosting server. Files are served over an SSL connection from the closest edge server on our 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 client-side routing or set up custom headers.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.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 our 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.