3. webOS
The new webOS created by Palm (acquired by HP) is the
first operating system where all possible native applications are
developed using web technologies. Every application on a webOS device is
created using HTML, CSS, and JavaScript, possibly with C and C++
plug-ins using the Plug-in Development Kit (PDK).
You can download the SDK, the PDK, and all the documentation from
http://developer.palm.com. You’ll also find an
Eclipse-based plug-in for code hinting and help in the design of these
applications here.
Note:
webOS has the only web-based IDE solution for creating mobile
applications. Ares (http://ares.palm.com/Ares/about.html) is a free mobile
development environment with code support where you can visually
design webOS applications.
A native web application for webOS is also called a
Mojo application. Mojo is a JavaScript UI library
based on the popular Dojo library that is generally used for creating
webOS applications.
Every webOS application has a main HTML base file, an icon file, a
configuration file (appinfo.json),
a list of source files (sources.json), and an app folder with all the contents of each
scene. A scene is a screen that shows information
to the user, divided into an assistant (a
JavaScript file for the behavior) and the view (an
HTML file).
The appinfo.json file looks
like this:
{
"id": "com.mystuff.hello",
"version": "1.0.0",
"vendor": "My Company",
"type": "web",
"main": "index.html",
"title": "Hello World",
"icon": "icon.png"
}
Every application is packaged in an .ipk file, created either with the Eclipse
plug-in or using the palm-package command-line tool
provided by the SDK.
Mojo allows JavaScript applications to have access to all the
features of the phone using the Service APIs: Accelerometer, Accounts,
Alarms, Application Manager, Audio, Browser, Calendar, Camera, Contacts,
Document Viewers, Download Manager, Email, GPS, Maps, Messaging, People
Picker, Photos, System Properties, Video, and more.
Note:
If you don’t like the Mojo framework, you can use other
frameworks for the UI. There is even a PhoneGap implementation for
Palm webOS with instructions available at http://wiki.phonegap.com.
The Mojo framework also includes many UI controls designed for
optimal visualization in the operating system. You can use it using an
empty div with the x-mojo-element attribute. For example:
<div x-mojo-element="ToggleButton" id="button"></div>
3.1. Distribution
You cannot serve an IPK package from your own website. The
end-user devices can only install applications from a trusted source,
such as the official store. To publish an application in the store,
you will first need to apply for a Palm Developer Program account
(free for open source projects and with a $99 fee for a full
account).
Once you have an account, you can publish your applications to
the App Catalog, the official webOS store. The applications can be
distributed as free or premium content.
If you want to distribute an application from your own website
instead, you can use the Web Distribution mechanism, which allows you
to publish your IPK file without Palm review approval. You will
receive a unique URL to give to users on your website to install the
application. Again, the application can be distributed as either free
or premium content, but there is no fee associated with this
publishing method.
For premium content, you will receive 70% of the revenue
generated by your application. You will be paid through PayPal. All
the application links are offered as public RSS files to anyone that
wants to integrate them in their websites.
3.2. HTML 5 applications
For the webOS browser, you can also create HTML 5 applications
that the user can add as favorite websites without any Palm Developer
Program subscription needed. These applications will not have access
to the Mojo toolkit or the other advantages of full native
applications. However, they will be able to use AppCache, offline
storage, and possibly geolocation features.
Remember to use a short title for the webapp. You should
encourage the user to add the webapp to the Launcher using Web→Page→Add to
Launcher. Unfortunately, webOS
does allow us to define an icon; it will use the title and a little
top-left corner screenshot of the website to identify it. You can
insert an icon there to emulate icon definition. When the user has
added your webapp, it will be available as an icon in the applications
menu.
Warning:
There is no way to know if the user has already added the
webapp to the Launcher, or if it was opened using that icon or the
URL.
The user can also use the Bookmark feature, which displays a
screenshot of the page as the icon.
4. Android
Android devices don’t yet have an iPhone-similar way to
create full-screen webapps using only markup. So, for mobile widget
development, we have two options:
4.1. HTML 5 webapp
Creating a webapp for Android devices is similar to creating one
for Palm devices: you can develop an HTML 5 application that uses
AppCache, offline storage, and maybe some Google Gears APIs, and the
user can add it to the bookmarks. Once it’s been bookmarked, we can
provide instructions to the user to add the application’s icon to the
home screen. The instructions vary depending on the Android version.
For Android 1.x devices:
Add this page to bookmarks using Menu→Bookmarks→Add to Bookmark.
Long press the new bookmark entry and select “Add shortcut
to Home.”
For Android 2.X devices, like the Motorola Droid or Nexus
One:
Add this page to bookmarks using the bookmark icon (you can
even provide a visual icon to the user) and select Add
Bookmark.
Long press the new bookmark entry and select “Add shortcut
to Home.”
The home screen shortcut will use the icon specified in the
apple-touch-icon-precomposed link
tag as the first option for the high-quality icon or the favicon.
4.2. PhoneGap solutionIf you want to use PhoneGap, you should download the
package and download the Android SDK. In Eclipse (with the Android
plug-in already installed), go to File→New Project→Android and point it to the android folder in the PhoneGap
package.
Copy all your HTML, CSS, JavaScript, and image files to the
android_asset folder (you can
leave the demo files already in that folder or replace them).
Then, edit the /res/value/strings.xml file and change the
value of the url field to file:///android_asset/index.html.
Build and test your application.
Note:
Android also supports home widgets as applications that run in
the background and show their contents on the home screen, similar
to the home screen widgets in Symbian. These are not web
applications, but rather Android Java applications, available since
version 1.5.
4.2.1. Distribution
You can distribute your PhoneGap Android application via your
own website, serving the .apk
file with the right MIME type: application/vnd.android.package-archive.
You can also distribute your application in the Android
Market, the official store from Google. Other stores will be
available soon, from other companies like Motorola.
You can apply for an Android Market account at http://market.android.com/publish; the initial fee is
$25. You will be able to publish free applications from anywhere and
premium applications if you are located in one of the available
premium application countries (the U.S. and the UK, at the time of
this writing). You will receive 70% of the revenue from your premium
web applications.
You can also distribute your Android applications via
Motorola’s official store, Shop4Apps. You can create a free
publisher account at http://developer.motorola.com/shop4apps.