Fu Cheng
Build Mobile Apps with Ionic 4 and FirebaseHybrid Mobile App Development2nd ed.
Fu Cheng
Sandringham, Auckland, New Zealand
ISBN 978-1-4842-3774-8e-ISBN 978-1-4842-3775-5
Library of Congress Control Number: 2018961558
© Fu Cheng 2018
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

To my wife Andrea and my daughters Olivia and Erica

Preface

Developing mobile apps is an interesting yet challenging task. Different mobile platforms have their own ecosystems. If you want to start building your own mobile apps, you have to learn new programming languages, frameworks, libraries, and tools. Building complicated mobile apps or games requires a lot of experience. These kinds of apps may not be suitable for beginners. But not all mobile apps are complicated. There are still many mobile apps that are content-centric. This kind of apps focuses on content presentations and doesn’t use many native features. For these kinds of apps, PhoneGap and its successor Apache Cordova offer a different way to build them.

Mobile platforms usually have a component called WebView to render web pages. Cordova uses this component to create a wrapper for running web pages inside of native apps. Cordova provides different wrappers for different platforms. The web pages become the mobile apps to develop. After using Cordova, developers can use front-end skills to create cross-platform mobile apps. This empowers front-end developers to create good enough content-centric mobile apps. Many other frameworks build on top of Cordova to provide out-of-box components to make building mobile apps much easier.

This book focuses on the latest version 4 of the popular Ionic framework. The best way to learn a new framework is using it in real-world product development. This book is not a manual for Ionic 4, but a field guide of how to use it. We’ll build a Hacker News client app using Ionic 4 and use this as the example to demonstrate different aspects of Ionic 4. This book not only covers the implementation of the Hacker News client app, but also the whole development life cycle, including development, unit tests, end-to-end tests, continuous integration, and app publish. After reading this book, you should get a whole picture of building mobile apps using Ionic 4.

Most of the nontrivial mobile apps need back-end services to work with them. Using mobile apps back-end services is a new trend that eliminates the heavy burden to write extra code and maintain the back-end infrastructure. Google Firebase is a popular choice of mobile apps back-end services. The Hacker News client app uses Firebase to handle user authentication and storage of user favorites data. After reading this book, you should be able to integrate Firebase in your own apps.

Included in This Book

This book is organized around building the Hacker News client app. Starting from the local development setup, each chapter focuses on implementing a user story. Here are some important topics:
  • Understanding Web Components and Stencil

  • Ionic 4 list component with infinite scrolling and pull-to-refresh

  • State management with NgRx

  • Routing with Angular Router

  • User management and third-party service logins with Firebase

  • Data persistence with Firebase Cloud Firestore

  • Unit testing with Karma and end-to-end testing with Protractor

  • App publishing

  • Features provided by Ionic Pro, including Ionic Deploy and Monitor

Below are the versions of main frameworks, libraries, and tools used in the app.
  • Angular - 6.1.10

  • RxJS - 6.3.3

  • NgRx - 6.1.0

  • Firebase - 5.5.4

  • AngularFire2 - 5.0.2

  • Jasmine - 3.2.0

  • Karma - 3.0.0

  • Protractor - 5.4.1

Not Included in This Book

Before you start reading this book, you should be clear about what is not included in this book.
  • This book is NOT an Ionic 4 manual. Although this book covers many Ionic components, it doesn’t include details about these components. If you want to know more about Ionic components, you should refer to the official documentation.

  • This book is NOT a Firebase manual. The official Firebase documentation should be the place to look for more information about Firebase.

  • This book is NOT a guide of building Angular web applications. Even though this book uses Angular as the framework binding for Ionic 4, it focuses on building mobile apps, not web applications. However, some practice used in the sample app can be applied to other Angular applications.

Who Should Read This Book?

This book is a field guide of building mobile apps with Ionic 4 and Firebase. Everyone who is interested in mobile apps development with Ionic 4 should read this book. This book is especially suitable for the following readers.
  • Individual developers. This book is a perfect match for individual developers. No matter if you want to build mobile apps for a living or as side projects, as an individual developer, you’re responsible for the whole development life cycle. This book covers all the necessary phases in the development life cycle.

  • Team members in a small team. If you are on a small team, it’s likely that you may need to touch different aspects of product development. This book can help you to understand the development life cycle to easily shift between different roles.

  • Development team members in a large team. If you are on a large team, you may only be responsible for some pages or components. This book covers some advanced topics related to web development, including routing, state management with NgRx, and advanced usage of RxJS, which can be useful in development.

How This Book Is Organized

This book is organized around building the example Hacker News client app with Ionic 4 and Firebase. Below is a brief description of all the chapters in this book.
  • Chapters 14 : Introduction of necessary background knowledge and local development environment setup.

  • Chapters 511 : Implementation of all user stories of the example app with Ionic 4 and Firebase.

  • Chapters 1215 : Additional topics related to Ionic.

Depending on your skill level, you can choose to skip some of these chapters. If you are an experienced Angular developer, you can skip the first four chapters.

Prerequisites

Ionic 4 is framework agnostic, and this book uses Ionic Angular as the framework binding. Basic knowledge of Angular and TypeScript is required to understand the code in this book. This book provides the basic introduction to Angular and TypeScript, but it’s still recommended to refer to other materials for more details.

To build Ionic 4 apps running on iOS platform, macOS is required to run the emulator and Xcode. You may also need real physical iOS or Android devices to test the apps.

Acknowledgments

This book would not have been possible without the help and support of many others. Thank you to my editors, Aaron Black, Jessica Vakili, and James Markham; and the rest of the Apress team, for bringing this book into the world. Thank you to my technical reviewer Felipe Laso Marsetti for your time and insightful feedback.

Many thanks to my whole family for the support during the writing of this book.

Table of Contents

Index 425

About the Author and About the Technical Reviewer

About the Author

Fu Cheng

is a full-stack software developer living in Auckland, New Zealand, with rich experience in applying best practices in real product development and strong problem-solving skills. He is the author of the book Exploring Java 9: Build Modularized Applications in Java (Apress, 2018), which covers the new features of Java SE 9 and provides a deep dive of Java platform core features. He is also a regular contributor to IBM developerWorks China and InfoQ China, with more than 50 published technical articles covering various technical topics.

 

About the Technical Reviewer

Felipe Laso

is a Senior Systems Engineer working at Lextech Global Services . He’s also an aspiring game designer/programmer. You can follow him on Twitter as @iFeliLM or on his blog .

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.112.69