Book Image

Mastering Firebase for Android Development

By : Ashok Kumar S
Book Image

Mastering Firebase for Android Development

By: Ashok Kumar S

Overview of this book

Firebase offers a wide spectrum of tools and services to help you develop high-quality apps in a short period of time. It also allows you to build web and mobile apps quickly without managing the infrastructure.Mastering Firebase for Android Development takes you through the complete toolchain of Firebase,including the latest tools announced in Google IO 2018 such as Firebase ML-Kit, FireStore, and Firebase Predictions. The book begins by teaching you to configure your development environment with Firebase and set up a different structure for a Firebase real-time database. As you make your way through the chapters, you’ll establish the authentication feature in Android and explore email and phone authentication for managing the on-boarding of users. You’ll be taken through topics on Firebase crash reporting, Firebase functions, Firebase Cloud, Firebase Hosting, and Cloud Messaging for push notifications and explore other key areas in depth. In the concluding chapters, you will learn to use Firebase Test Lab to test your application before using Firebase Performance Monitoring to trace performance setbacks. By the end of the book, you will be well equipped with the Firebase ecosystem, which will help you find solutions to your common application development challenges.
Table of Contents (23 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
9
Application Usage Measuring and Notification, Firebase Analytics, and Cloud Messaging
11
Bringing Everyone on the Same Page, Firebase Invites, and Firebase App Indexing
12
Making a Monetary Impact and Firebase AdMob and AdWords
13
Flexible NoSQL and Cloud Firestore
14
Analytics Data, Clairvoyant, Firebase Predictions
Index

Writing Firebase functions


Firebase functions are convenient and powerful. But, sometimes you need to know the correct spells to make your magic work efficiently and effectively. Although we write all the code inside index.js, we have to learn many more things, and that happens only with practice. If you choose TypeScript while creating the project - if you want to explore the TypeScript way of using Firebase functions - it's almost the same, but with a few contract changes. 

The file type when we choose TypeScript will be .ts; therefore, our index.js will be index.ts. Every time you deploy the code, you need to make sure the TypeScript code transpiled and then hosted. In case of TypeScript, we need to configure tsconfig.json; follow these steps to make sure of valid configurations.:

  1. In package.json, add the bash command to build the TypeScript project:
{
"name": "functions",
"scripts": {
"build": "./node_modules/.bin/tslint -p tslint.json && ./node_modules/.bin/tsc"
}
  1. In firebase.json...