O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beginning App Development with Parse and Phonegap

Book Description

Beginning App Development with Parse and PhoneGap teaches you how to start app development with Parse and PhoneGap: free and open source software. Using the building block languages of the web--HTML, JavaScript, and CSS--you’ll be on your way to creating a fully working product with minimal effort as fast as possible. With over 25 years' of combined experience, the authors make daunting tasks seem trivial. There is no book on the market that can take you from designer to developer faster.

Using Facebook’s Parse as backend service, and Adobe’s PhoneGap (or Cordova) as a mobile development framework, building a highly customizable application is easier than you can imagine. A basic understanding of JavaScript, HTML, and CSS is not required, but it will help you pick up concepts faster.

This book is geared toward a designer who wants to explore the world of application development. If you do not know anything about design, that’s OK! We will walk you through step by step on how to build your first native iOS or Android app in the fastest and easiest way possible. Using free and open source software, this book will get you up and running quickly and efficiently--start using Parse and PhoneGap today with this key title.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. Preface
  8. About the Authors
  9. About the Techincal reviewer
  10. Acknowledgments
  11. Chapter 1: Introduction
    1. What Is PhoneGap?
      1. History
      2. How PhoneGap Works
      3. Foreign Function Interface
      4. Supported Platforms
      5. PhoneGap vs. Web Applications
    2. Building and Testing PhoneGap Applications
      1. The Adobe PhoneGap Build Service (Optional)
      2. Caveats
      3. Why We Don’t Use Adobe PhoneGap Build in This Book
      4. Collaboration and Testing Tools
    3. Using Parse
      1. Developing Applications with Parse
      2. Features
    4. Why Parse and PhoneGap?
      1. Make Your Application Social
    5. Previous Knowledge and Requirements
      1. JavaScript Object Literals
      2. Namespaces with Object Literals
      3. Organizing Code for Projects in This Book
      4. Loading Scripts with LABjs
      5. Build Process
      6. Debugging
      7. Command-Line Interface Tools
      8. Integrated Development Environment (IDE)
      9. What You Will Learn about PhoneGap and Parse
      10. Going Further
  12. Chapter 2: Beginning PhoneGap
    1. Platform Setup and Restrictions
    2. Installing Node.js and Node Package Manager
    3. iOS Environment Setup
      1. Command Line Tools for Xcode
      2. iOS Launcher Packages
    4. Android Environment Setup
      1. Java Development Kit (JDK)
      2. Android SDK Installation
      3. Android SDK Manager
      4. Choosing an Android Emulator Image
      5. Managing Virtual Devices
      6. Adding Android SDK Paths
      7. Installing Apache Ant
      8. Installing PhoneGap
      9. Updating PhoneGap
      10. Using the PhoneGap CLI Tools
    5. Creating a New PhoneGap Application
      1. PhoneGap “Hello World” Application
      2. Building Applications
      3. Running Applications
      4. Device Selection
      5. Inside PhoneGap’s “Hello World” Application
      6. Main Application Script (index.js)
    6. Debugging PhoneGap Applications
    7. Summary
  13. Chapter 3: Beginning Parse
    1. Parse Features at a Glance
    2. Creating and Setting Up a Parse Project
      1. Web Hosting
      2. Configuring a Parse Application’s Subdomain
      3. Installing the Parse CLI for Application Publishing
      4. Setting Up Folders
      5. Creating a New Project
      6. About Parse Project Files and Folders
      7. Deploying a Parse Project
    3. Building a CRUD Application
      1. Updating index.html of the Parse Starter Project
      2. Adding Custom UI Elements
      3. Adding Script References
      4. Customizing CSS
      5. Creating a JavaScript Application File
      6. Creating a New Record
      7. Retrieving Existing Records
      8. Parse.Query Object
      9. Updating crud.retrieve
      10. Testing Record Retrieval
      11. Extending Queries
      12. Query Methods
      13. Sorting Results
      14. Updating Records
      15. Deleting Records
      16. Cloud Code
      17. Complete Code
    4. Summary
  14. Chapter 4: Tools and Helpers
    1. jQuery to the Rescue
      1. Use jQuery Responsibly
      2. Why jQuery Matters for This Book
    2. Twitter Bootstrap
      1. Use Bootstrap Responsibly
      2. Why Twitter Bootstrap Matters for This Book
    3. JavaScript Templates with Handlebars.js
      1. Static vs. Dynamic Web Sites
      2. When to Use Dynamic Templates
      3. Why Handlebars.js Matters for This Book
    4. Loading JavaScript Files
      1. Script Loading Today
      2. Script Loading in PhoneGap
      3. LABjs Script Loader
    5. PhoneGap Testing Tools
      1. PhoneGap Developer App
      2. PhoneGap App Desktop Beta
    6. Summary
  15. Chapter 5: Facebook API
    1. The Facebook Developer Platform
      1. Sharing
      2. User Management and Permissions
      3. Friends
      4. Monetization
      5. Insights
    2. Goals and Requirements for This Chapter
      1. Creating a New PhoneGap Application
      2. Creating a Facebook Developer Account
      3. Creating a Facebook Application Instance
      4. Installing the Facebook PhoneGap Plug-in
    3. Graph API Explorer
    4. Resetting Permissions
    5. Usage Examples
      1. Basic Setup
      2. Login with Facebook
      3. Requesting Publishing Permissions
      4. Getting a User’s Email Address
      5. Verifying Permissions
      6. Making API Requests
      7. POST to Facebook via Graph API
      8. Uploading a Picture
      9. Share Dialog
    6. Summary
  16. Chapter 6: The Messenger Application
    1. The Messenger App
      1. Goals for the Messenger App
      2. Application Views
    2. Choosing Third-Party Libraries
    3. Project Setup
      1. Application File Setup
      2. Testing Your Application
      3. Loading Application Scripts
    4. The Home Page View
    5. Summary
  17. Chapter 7: User Registration with Parse
    1. Parse User Registration
      1. Preparation: Adding View Initialization
      2. Registration View
      3. Registration Task
      4. Preparing User Data
      5. Sending User Data to Parse
      6. Updating Your Application Code
      7. User Registration Recap
    2. Login and Logout Using Parse
      1. Login: Setting Up the Template
      2. Login: Verifying Credentials
      3. Logout: Template and Functionality
    3. Protecting Views for Logged-in Users
      1. Configuring Access Control
      2. Navigation Bar for Logged-in Users
    4. Resetting a Password Using Parse
      1. The Forgot Password Template
      2. Parse’s Forgot Password Feature
      3. Testing the New Feature!
    5. Registration and Login via Facebook
      1. How Parse Integrates with Facebook
      2. Facebook JavaScript SDK Setup
      3. Facebook PhoneGap Plug-in
      4. Logging with Facebook View
    6. Listing Users
      1. Preparation
      2. Contacts Template
      3. Query Users
      4. E-Mail Verification
      5. E-Mail and Web Templates
    7. Summary
  18. Chapter 8: Messages
    1. Conversation vs. ConversationList
    2. Parse Classes and Their Roles
    3. Senders and Receivers
    4. Writing Messages
      1. Creating the Conversation View Template
      2. Prepping for a Conversation
      3. Reading URL Query Parameters
      4. Initializing the View
      5. The Loading Icon
      6. Creating a Receiver Object
      7. Loading the Actual Receiver Object
      8. Message Form Handler
      9. The Message Class
    5. Sending a Message
      1. Sending a Test Message and Review
      2. Improving Dialog Styles (Optional)
      3. Features Offered by the Dialogs Plug-in
    6. Reading Messages
      1. Querying Conversation Messages
      2. Compound Queries
      3. Managing Conversations
      4. Rendering the Conversation View
      5. Creating the Conversation Template
      6. User Interface Optimizations (Optional)
    7. Listing Conversations
      1. Gathering Metadata for Messages
    8. Tracking Conversations
      1. Setting Up the MyParseConversation Class
      2. Updating Conversation Meta Information
      3. Querying Latest Conversations
      4. Preparing Conversation Data for Rendering
    9. Conversation List Template
    10. Summary
  19. Chapter 9: Location Services
    1. Geolocation Plug-in
      1. geolocationSuccess
      2. geolocationError
      3. geolocationOptions
    2. Adding Location Information to a Message
      1. Geolocation Permission Settings
      2. Geolocation in Parse
    3. Location Setting Interface
      1. LocalStorage for Device-Related Information
      2. Location Setting Button
    4. Background Service for Location Tracking (iOS)
      1. Plug-in Setup
      2. Device Identification
      3. Save Data to Parse
      4. Running Background Task
      5. Testing Your Results
      6. Excursion: CartoDB
    5. Geocoding
      1. Mapbox
      2. Geocoding in the Parse Cloud
      3. Converting the Geolocation into a Location Name
      4. Geocoding Methods
      5. Combining Parse and Mapbox
    6. Summary
  20. Chapter 10: Map Views
    1. Two Approaches to Adding Map Views
      1. JavaScript Map SDKs
      2. Native Map SDKs
      3. Recommendation
    2. Adding a JavaScript Map View
      1. Mapbox JavaScript Library Setup
      2. Adding a Map to a Message
      3. Adding Map Controls
      4. Adding a Full-Screen Mode
      5. Testing the Map View
    3. Adding a Native Map View
      1. Google Maps Plug-in Installation
      2. Google Maps View
      3. Google Maps Implementation
      4. Google Maps Module
      5. Hiding the Conversation View
      6. Google Maps Instance
      7. Google Maps “GeoPoint”
      8. Localizing the Message Location
      9. Closing the Map View
      10. Initializing the Map View
      11. Handling Layer Conflicts
      12. Adding a Message Marker
    4. Geo Queries
      1. Radial and Box Queries
      2. Getting Nearby Messages
      3. Getting Messages within Map Bounds
    5. Summary
  21. Chapter 11: Accessing and Sharing Photos
    1. Enabling Camera Access
      1. User Interface for Photo Sharing
      2. Photo and Camera Button
    2. JavaScript Module for Accessing Photos and Camera
    3. PhoneGap Camera Plug-in
      1. Optional Camera Options
      2. Using the Camera Plug-in
      3. Camera and Photos Permissions
    4. Using Parse Files
      1. Saving a Photo to Parse
      2. Camera and Album Event Handler
      3. Photo Capture Callback
      4. Attaching a Photo to a Message
    5. Image Resizing in the Parse Cloud
      1. Validating Data
      2. Parse Cloud HTTP Request
      3. Using the Resized Image
    6. Summary
  22. Chapter 12: Network Connection Status
    1. Code Preparation
      1. Class Properties
      2. Last Seen
      3. Update the Contacts List View
    2. Network Information Plug-in
      1. Update the UI
      2. Listening for Updates
    3. Summary
    4. Conclusion
  23. Index