Tuesday, July 1, 2014

Mobile Development with Cordova (Phonegap): Glossary

Chapter 0: Mobile Development Glossary

Before I get started, I want to define a few terms. This also acts as a brief introduction to the concepts: that you need a provisioning profile to work on iOS, that you sign apps, etc.

Hybrid App
This is what you'll write with Cordova. It's not a truly native app written in Java (Android) and Objective C (iOS) but is basically a web application with a self-contained browser. It has an icon and is in the store, so it acts like a native app, but it's not really written in the same way.

Cordova / PhoneGap
Cordova is essentially an embedded browser which launches as an app. The upshot is that you can write CSS/HTML/JavaScript and it will be interpreted in this browser. Unlike traditional web browsers, the Cordova browser has additional functionality such as accessing the accelerometer, compass, GPS, camera, and filesystem (SD card). PhoneGap is a Adobe's name for the project and their commercial offerings such as Phonegap Build, while Cordova is the name of the open-source project over at Apache. The documentation at PhoneGap.com applies to Cordova, and the two terms are used practically interchangeably.

Digital Signature
A cryptographic process by which a file is "signed" based on a "certificate" A digital signature is infeasible to forge, so a matching signature is presumptive evidence that  the file is signed by the person who owns the certificate. Digital signatures are used to verify that two apps came from the same author, most notably if a new app claims to be an upgrade of a pre-existing app. If the signatures do not match, then the second is presumed to be fake and will not be installed.

Digital Certificate
A certificate is a cryptographically-strong set of numbers, used for encryption and digital signatures. A certificate consists of two parts: a public part (given out to the public, the visible certificate) and a secret part (the key). A signature can be verified using only the public part of the certificate, while a signature may only be generated using the secret part of the certificate. A digital certificate can be "issued" by a signing authority (Apple for iOS apps, GoDaddy for website SSL certificates), or a person can generate their own "self-signed" certificate for personal or internal use. Apple issues certificates to developers, while android allows you to generate your own self-signed certificates.

An integrated development environment (IDE) for OSX. It is used to compile Cordova apps for iOS, as well as for making changes to the build settings, e.g. whether the status bar should remain visible. Xcode consists of the GUI tools, as well as a set of command-line apps. For the most part, I use Xcode to run my apps on the iPad and iOS emulators, then to archive the package to an IPA and sign it, but I don't use it as my text editor.

An integrated development environment (IDE) that runs on Windows, OSX, and others. A very popular alternative to a simple text editor. I myself don't use Eclipse, but a lot of people do.

Developer Certificate
A digital certificate generated by Apple for the purpose of identifying a specific Apple developer. An Apple developer may have more than one certificate. These are generated at Apple's developer portal, and Xcode has a facility to download them and to allow you to select which on you'll use to sign your programs.

Development certificate / Distribution certificate
Digital certificates issued by Apple, used to sign apps. An app signed with a development certificate can only run on devices registered to that same developer. An app signed with a distribution certificate, is suitable for deployment to other devices and to the App Store. An Ad Hoc certificate is a type of Distribution certificate, and is described below. These are generated via Apple's developer portal, and Xcode has facilities to import them from your developer account.

Provisioning Profile
A statement from Apple that a given combination of Developer Certificate, Application IDs, and Device IDs, is allowed to run this app. This is particularly relevant when using Ad Hoc Distribution, as the app will only run for the Device IDs specified in the Provisioning Profile. These are generated via Apple's developer portal, and Xcode has a facility to download them from your developer account. When you "archive" your app to generate an IPA file, you'll be asked to choose a Provisioning Profile to sign the resulting IPA. Note that you'll have separate Provisioning Profiles for posting an app to the store versus handing it out for Ad Hoc beta testing.

Ad Hoc Distribution
Distribution of an app without the Store and its approval process, usually intended for beta testing and limited distribution. An Ad Hoc Provisioning Profile would be created, listing the specific applications and devices allowed. Note that an Apple developer account can only have 100 devices listed, and can only change this list at the beginning of each calendar year. Thus, Ad Hoc Distribution is not necessarily suitable for distribution to an entire organization, especially if you're a contracting house with numerous clients: 5-10 testers per client can exhaust 100 slots quickly. Further, the Apple developer is only allowed to register devices of the same model as devices they already own (the developer must have an iPod registered in their name, in order to add an iPod to the device list for Ad Hoc Distribution).

For Android platforms, multiple digital certificates may be combined into a single file called a keystore. Each certificate within a keystore, has an alias identifying that key within the keystore. Typically, a keystore is encrypted with a password, and certificates within the keystore may also be individually encrypted with their own passwords. In order to uniquely identify and use a given certificate, the alias of the certificate must be known, as well as the password to the keystore, as well as the password to the individual certificate.

Keychain Access
A program on OSX for generating digital certificates. It can also convert them, import them from Apple's website, etc.

Android Debugging Bridge. This command-line tool communicates with attached Android devices over the USB, and can load software into them, reboot them, and so on. The command adb devices will come up often, as it's used to show a list of attached Android devices... which is how you verify that your device is attached and can be used to run and test your app.

USB Debugging Mode
On Android, this is a special setting that enables the USB connection to be used for that stuff described in adb above. To use your Android device via adb, you absolutely must have USB Debugging Mode enabled.

Android SDK
The Android Software Development Kit (SDK) is a collection of software and libraries allowing you to compile apps for Android, and allowing your Mac to communicate with Android devices via adb. This includes Android OS images and emulators, and API libraries.

No comments:

Post a Comment