Building Mobile Applications Creating ios applications with jquery Mobile, PhoneGap, and Drupal 7



Similar documents
Introduction: The Xcode templates are not available in Cordova or above, so we'll use the previous version, for this recipe.

MEAP Edition Manning Early Access Program Hello! ios Development version 14

Lecture 4 Cross-Platform Development. <lecturer, date>

ios SDK possibilities & limitations

Develop a Native App (ios and Android) for a Drupal Website without Learning Objective-C or Java. Drupaldelphia 2014 By Joe Roberts

SYST35300 Hybrid Mobile Application Development

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

PhoneGap Build Starter

Mobile Learning Application Based On Hybrid Mobile Application Technology Running On Android Smartphone and Blackberry

Cross-Platform Phone Apps & Sites with jquery Mobile

Adobe Summit 2015 Lab 712: Building Mobile Apps: A PhoneGap Enterprise Introduction for Developers

Cross-Platform Tools

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

Software Development Environment. Installation Guide

About this Release. Introduction. Prerequisites. Installation. Using the Web SDK Packager

max firt.mobi martes 26 de julio de 11

CiviMobile & CiviSync Mobile. Peter McAndrew Rohit Thakral

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

How To Use Titanium Studio

Xcode Application note

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

Building native mobile apps for Digital Factory

To Study and Design a Cross-Platform Mobile Application for Student Information System using PhoneGap Framework

Retool your HTML/JavaScript to go Mobile

More details >>> HERE <<<

Chapter 1. Introduction to ios Development. Objectives: Touch on the history of ios and the devices that support this operating system.

Developing Applications for ios

Full version is >>> HERE <<<

MOBILIZE ME! APPS FOR MOBILE DEVICES OR MOBILE WEB APPS TECHNOLOGIES, TOOLS, ASSESSMENTS

Developing multidevice-apps using Apache Cordova and HTML5. Guadalajara Java User Group Guillermo Muñoz Java Developer

Navigating the Mobile App Development Landscape

Mobile Development Frameworks Overview. Understand the pros and cons of using different mobile development frameworks for mobile projects.

Take full advantage of IBM s IDEs for end- to- end mobile development

Cross-Platform Development

Technical and Business Challenges for Mobile Application Developers. Tony Wasserman Carnegie Mellon Silicon Valley Mobicase 2010

Preparing your MAC Computer to access QuickBooks Hosted with the Citrix Receiver or Online Plugin

Mobile App Proposal Magazine company- @address.com. January 12, y. Direct Contact.

Your First App Store Submission

Lecture 3 Mobile App Development (Android, ios, BlackBerry, Windows Mobile) <lecturer, date>

Lab 0 (Setting up your Development Environment) Week 1

The End is Near. Options for File Management and Storage

Downloading an Acted ebook Accessing an ActEd ebook on more than 1 computer/device Printing an ActEd ebook

research: technical implemenation

Installing the Android SDK

Getting Started. with VitalSource Bookshelf. How to Access your ebooks Using VitalSource Bookshelf

Avira Secure Backup INSTALLATION GUIDE. HowTo

Enterprise Mobile Application Development: Native or Hybrid?

CMS, CRM, shopping carts, Web applications

Smartphone Application Development using HTML5-based Cross- Platform Framework

Building Apps for iphone and ipad. Presented by Ryan Hope, Sumeet Singh

Generate Android App

Making Mobile a Reality

Cross Platform Applications with IBM Worklight

Mobile and Social Computing

App Distribution Guide

Net 2. NetApp Electronic Library. User Guide for Net 2 Client Version 6.0a

Mobile Phones Operating Systems

Enterprise Mobile App Management Essentials. Presented by Ryan Hope and John Nielsen

LIBRARY MEMBER USER GUIDE

Cross-Platform Mobile Apps Solution

Choosing a Mobile Application Development Approach

Developing Cross-platform Mobile and Web Apps

Setting Up Your Android Development Environment. For Mac OS X (10.6.8) v1.0. By GoNorthWest. 3 April 2012

ESC Mobile App Guide

Here s how to choose the right mobile app for you.

01. Introduction of Android

Available on VitalSource

Mobile Application Design

Downloadable ebooks and Audiobooks at McKinney Public Library

Supported Hardware and Software. Sybase Mobiliser Platform 5.1 SP03

Quick Start Guide Mobile Entrée 4

Choosing a Mobile Strategy for Your Business

White Paper INTRODUCTION. In mobile development, there are three different types of applications: PRE-SMARTPHONE MOBILITY NATIVE MOBILE APPLICATIONS

FAMILY. Reference Guide. Pogoplug Family. Reference Guide Cloud Engines, Inc. All Rights Reserved.

The story so far: Teaching Mobile App Development at PG level at Londonmet

Remote Desktop Services

How to use Dropbox. What is Dropbox. Please read the University of Melbourne Guidelines on Dropbox and University Information prior to use.

Grab Your Tablet, Because You re Gonna Build A Mobile Apex App in One Hour!

Access the TCNJ Palo Alto Networks VPN using the GlobalProtect VPN client

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02

Development for Mobile Devices Tools from Intel, Platform of Your Choice!

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

Bridging the Gap: from a Web App to a Mobile Device App

Evaluating Cross-Platform Development Approaches (WORA Tools ) for Mobile Applications

ios App Development for Everyone

Enabling Cordova (aka PhoneGap) on Tizen. René Pourtier / Luc Yriarte

ONLINE ACCOUNTABILITY FOR EVERY DEVICE. Quick Reference Guide V1.0

LIBRARY MEMBER USER GUIDE

The Bootstrapper's Guide to the Mobile Web by Deltina Hay. Mobile App Strategy Worksheet. I. Target Market, App Category, Platforms

QML and JavaScript for Native App Development

Introduction to Programming with Xojo

Novell Filr. Mobile Client

Hello. If you have any questions that aren t addressed here, feel free to contact our support staff.

How to Download an Ebook in 3 Easy Steps

Packaging for Distribution

Transcription:

Building Mobile Applications Creating ios applications with jquery Mobile, PhoneGap, and Drupal 7 Jeff Linwood 1st Chapter, Early Release

Introduction... 3 Prerequisites... 3 Introduction to Mobile Apps... 4 Getting Started with PhoneGap... 6 Prerequisites and XCode 4... 6 Installing PhoneGap... 6 Building Your First PhoneGap App for ios... 7 More to come!... 15

Introduction I m excited about Drupal and mobile, and I hope you are too! There s a lot you can do with your existing Drupal site to bring it into the mobile world, including putting a mobile theme on it, or making your main theme responsive. In this book, I m going to discuss another option, which is building a stand-alone mobile app for the iphone with jquery Mobile and PhoneGap that communicates with your Drupal server using the Services 3 module. PREREQUISITES I m not going to assume that you know anything about mobile apps, or that you know anything about Drupal s Services 3 module, REST, jquery Mobile, XCode 4 or PhoneGap. You should have administrative access to a Drupal 7 site (either running on a server, or running locally), and know how to install modules onto your Drupal site. I m going to assume that your Drupal site is already set up - if you haven t set up Drupal yet, there are many good books, and there is an installation guide on Drupal.org (http://drupal.org/documentation/ install). This book covers Drupal 7, not Drupal 6, although much of the discussion is the same. Unfortunately, the data formats used for expressing nodes in JSON changed between Drupal 6 and 7, so you can t use exactly the same code. You will need to download and install XCode 4 from Apple, which basically means that you have to have a recent Mac. You can get XCode 4 from the Mac App Store, or from http:// developer.apple.com.

Introduction to Mobile Apps What are mobile apps? What makes them different from a web site? These are questions I get asked frequently when I speak about building mobile apps. There are three different kinds of mobile apps: Native mobile applications will only work on one platform - Android, ios, BlackBerry, Symbian, or Windows Phone. When you develop a native app for Android, you most likely will be using the Java programming language with the Android SDK. You can use Windows, Mac, or Linux to develop for Android, which is convenient. Writing an app for the iphone or ipad requires a Mac and Apple s XCode 4 IDE. You need to learn the Objective-C language to write a native app for the iphone or ipad. HTML5 Mobile Applications work on at least one platform, but if written well, should work on more than one. Often, it s not the type of smartphone that is the problem, but the underlying browser technology it uses. For instance, both Android and ios use WebKit for the browser, so

an HTML5 mobile app should work almost identically on both platforms. Windows Phone uses a version of Internet Explorer, and you ll need to keep that in mind if you target Windows Phone as a platform. BlackBerry has moved to WebKit in recent versions of its operating system, but earlier BlackBerry devices use a much more primitive web browser. Typically, you d use a mobile toolkit such as Sensa Touch, Toura Mobile, Jo, or jquery Mobile to make your app work smoothly across browsers with an app-like feel. Each of these is evolving quickly - in this book, I m going to discuss jquery Mobile, but much of what I talk about applies to the others as well. Combining HTML5 and native application development, you get into Hybrid applications. The Facebook mobile application is a great example of this - you can download the Facebook app from the Apple App Store or the Android Market, but the app itself is built with a combination of native functionality and HTML. Facebook did this to simplify cross-platform development, and to have a faster development cycle. PhoneGap (http://www.phonegap.com/) is the leading open source toolkit to embed HTML5 mobile applications in a native ios, Android, BlackBerry, Windows Phone, or WebOS app. A PhoneGap app is based around the native app s web browser control. The HTML5 mobile app runs inside the web browser control, but it can leverage more functionality than an app running in the mobile browser by using the standard PhoneGap API or by using PhoneGap plugins. In 2011, Adobe bought Nitobi, the makers of PhoneGap, so there may be some changes to PhoneGap s product and service offerings.

Getting Started with PhoneGap The first step we re going to take is the classic, Hello World - but as a mobile app for ios! Using PhoneGap, this is actually very straight forward. PhoneGap lets us wrap HTML web pages in a native app wrapper, and it provides access to sensors on the device such as the camera, the accelerometer, and the current location of the device. PREREQUISITES AND XCODE 4 You will need a recent Mac, capable of running Apple s XCode 4 IDE (integrated development environment). As of the writing of this book, the current version of XCode is 4.2, and you may download and install it from the Mac App Store. If you want to run your app on your actual iphone, ipod Touch, or ipad, you will need to purchase a $99/year ios developer subscription from Apple. This also allows you to view technical information on their developer web site, gives you early access to beta software, and allows you to publish your apps in the ios App Store. INSTALLING PHONEGAP You can follow the directions for downloading and installing the latest version of PhoneGap from http://phonegap.com/start/#ios-x4 The first step is to download the PhoneGap distribution (at the time of writing, 1.4.1). The distribution contains libraries for all supported platforms: Android Bada BlackBerry ios (iphone, ipod Touch, and ipad) Symbian WebOS Windows Phone We re only concerned with the ios version of PhoneGap, which is in the lib directory under ios. You ll see a DMG file. Double-click it to open it, and you ll find detailed instructions, an upgrade guide, a license, and an installer - the PKG file.

The installer will do its work and install PhoneGap so that you can use it from XCode 4. BUILDING YOUR FIRST PHONEGAP APP FOR IOS For this book, I m using XCode 4.2 as the IDE for ios, so I linked to the specific directions for that platform. I m also going to target ios 4.x and above, using the PhoneGap Media Capture API to access the camera. After running the PhoneGap installer, open XCode 4 and start a new project. If the startup screen doesn t appear asking you to either open an existing project or create a new project, use File->New->New Project... from the XCode 4 menu. You should see the PhoneGap template as one of your options:

Click Next on the Choose a template dialog I m going to use DrupalApp as my Product Name, and com.jefflinwood as my company identifier. Uncheck Automatic Reference Counting - ARC is a feature that allows you to not have to write as much memory management code if you need to write native code. The downside is that if you use third-party plugins for PhoneGap, they have to use ARC, or you have to add a linker flag to your build settings for each source code file. Things may change in the future, but my Drupal Plugin for PhoneGap for ios doesn t use ARC, and the third-party libraries it depends on don t either. Click Next. Now put your new project into a folder of your choice (for instance, under your home directory s Documents), and let XCode 4 create a local git repository if it offers to.

Click Create XCode 4 will do some processing, and then you should see your new DrupalApp project in Xcode.

Hit the Run button in the upper left hand corner of XCode to run your project in the iphone or ipad Simulator. PhoneGap will load, but it won t have any content to display. The first time you run your project, PhoneGap will actually create a www folder you can drag into XCode to get started. Here s what the iphone Simulator will look like:

Now that we have our XCode project set up, and we ve run our project, we need to add the www folder to our project. With the current version of PhoneGap, this needs to be done manually the template isn t set up to import the www folder into the XCode project. Luckily, this is pretty easy. Open up the DrupalApp project folder in Finder. It should look like this: Drag the www folder onto your XCode DrupalApp Project, right between DrupalApp and PhoneGap.framework. This is so XCode will bundle the contents of the www folder with your app when it packages the app to run on the iphone Simulator or on an iphone, ipod Touch, or ipad.

Xcode will prompt you to create folder references for any added folders be sure to choose this option if the Create groups option is selected. Click Finish. Now run the project again, (stopping the currently running DrupalApp if it is still running) and PhoneGap should let you know it s working:

More to come! I hope you ve enjoyed the first chapter of my e-book - any feedback you have, please send it to me at jlinwood@gmail.com or reach out to me through Twitter: @jefflinwood Jeff Linwood