Build MobileApps with Ionic 4and Firebase Hybrid Mobile App Development Second Edition Fu Cheng Build Mobile Appswith Ionic 4 andFirebaseHybrid Mobile AppDevelopmentSecond EditionFu ChengBuild Mobile Apps with Ionic 4 and Firebase: Hybrid Mobile AppDevelopment Fu Cheng Sandringham, Auckland, New Zealand ISBN-13 (pbk): 978-1-4842-3774-8 ISBN-13 (electronic): 978-1-4842-3775-5 https://doi.org/10.1007/978-1-4842-3775-5 Library of Congress Control Number: 2018961558 Copyright 2018 by Fu Cheng 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. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Aaron Black Development Editor: James Markham Coordinating Editor: Jessica Vakili Cover image designed by Freepik (www.freepik.com) 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 orders-ny@springer-sbm.com, 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. com/rights-permissions. com/rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-3774-8. For more detailed information, please visit http://www.apress.com/source-code. Printed on acid-free paper To my wife Andrea and my daughters Olivia and EricaTable of Contents v Table of Con T T able of Con enT en s vi Table of Con T T able of Con enTs vii Table of Con T T able of Con enT en s viii Table of Con T T able of Con enTs ix Table of Con T T able of Con enT en s x Table of Con T T able of Con enTs xi Table of Con T T able of Con enT en s xii Table of Con T T able of Con enTs xiii About the AuthorFu 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. xv About the Technical ReviewerFelipe Laso is a Senior Systems Engineer working at Lextech Global Services. Hes also an aspiring game designer/programmer. You can follow him on Twitter as @iFeliLM or on his blog. xvii 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. xix 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 doesnt 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. Well 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, xxi Prefa Pref C a e 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. Included in This Book This book is organized around building the Hacker News client app. 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 xxii Prefa Pref C a e 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
Next page