This document provides an overview of Firebase and how to use it with Android applications. It discusses Firebase features like the realtime database, authentication, and hosting. It then covers how to set up a Firebase project in Android Studio, write and read data from the Firebase database using the SDK, handle different types of read events, query data, and secure data with security rules. Authentication options like custom authentication are also explained. Code samples are provided for common tasks like writing, reading, and querying data.
Subject represents an object that is both an Observable and an Observer. It allows objects to subscribe to it as an Observable and also emit events to observers as an Observer. There are different types of Subjects including PublishSubject, BehaviorSubject, AsyncSubject, and ReplaySubject. PublishSubject simply publishes events to observers, BehaviorSubject caches the last emitted value, AsyncSubject only emits the last value upon completion, and ReplaySubject caches emitted values and replays them to new observers. Subjects can be used to build event buses to facilitate loose coupling between components.