True Offline Echo Apps on the Apple iPhone: Proof-of-Concept SDK

tliebeck's picture

I finally took the plunge and picked up an iPhone a few days ago. While I was looking around for neat things that might be possible to do with it using Echo3, I ran into this page. It discusses the use of RFC 2397 (the "data" URL scheme) to embed images and even entire JavaScript/HTML applications into URLs. When you combine this with the fact that the iPhone now supports bookmarking web URLs and adding them to its "home screen", we have everything we need to create client-side Echo3 applications in JavaScript and package them up for offline iPhone use. That is, it's possible to create real Echo3 apps that can run even when the phone is out of network range or in "airplane mode".

There was one caveat: encoding URLs and applications using RFC 2397 is a horribly tedious process. My solution has been to throw together a proof-of-concept software development kit to take the pain out of it. You put in your JavaScript application and any other JS libraries you need, and out pops a ready-to-run offline Echo app for the iPhone. It can be downloaded from /content/echo3/iphone/echo-off-sdk.0.0.1.zip. Please bear in mind that this was written in one day with a cold and is thus the farthest thing from being polished.

For a simple proof-of-concept app, I've chosen the truly awful "Guess-A-Number" example. It looks just as ugly on the iPhone as it does on a desktop computer. Developing a library with a stylesheet and a few components to mimic the iPhone look&feel would go along way toward changing that. Additionally, in the case of "Guess-A-Number", it probably makes sense to change the text input field to a select field (numeric entry on an iPhone requires a few too many taps).

As well-engineered as the Mobile Safari browser is, it is necessarily different from a desktop computer's web browser. Echo3's "Pane" components, e.g., SplitPanes and WindowPanes, have fairly limited functionality on the iPhone in their current states. In my present opinion they are of no benefit to an iPhone-specific application's user experience. Other Echo components may need some teaking in order to work to their full potential.

The "SDK"

The offline SDK allows the developer to configure an application build using an XML file. Below is a sample used by the NumberGuessApp:

<build>
 <title>#Guess</title>
 <icon>NLogo.png</icon>
 
 <!-- EchoLite.js has no splitpane/windowpane support, no IE6 support, and no ARC support. -->
 <lib>EchoLite.js</lib>
 
 <lib>NumberGuess.js</lib>
 <image-namespace name="NumberGuessApp.Images">
  <image name="titleBanner">TitleBanner.png</image>
  <image name="congratulationsBanner">CongratulationsBanner.png</image>
 </image-namespace>
 
 <!--
 <save-html>out/out.html</save-html>
 <save-url>out/url.txt</save-url>
 -->

 <!-- The redirect and start pages should be deployed to the server -->
 <save-redirect>out/redirect.html</save-redirect>
 <save-start-page>out/start.html</save-start-page>
</build>

The lib elements define the JavaScript modules of the application. They'll be automatically compressed using Yahoo's YUI compressor.

The title and icon elements specify the page title and icon that will appear on the iPhone home screen.

The image-namespace elements of the build file will generate JavaScript code containing URLs that actually contain an image's data. In the above example, it will generate the following code:

NumberGuessApp.Images = {
    titleBanner: "data:image/png;base64,gHFhwf7234....",
    congratulationsBanner: "data:image/png;base64,f7ghw23HF7...."
};

You then use these objects to refer to your images, e.g.:

new EchoApp.Label({
    icon: NumberGuessApp.Images.titleBanner
})

The save-start-page element generates a trivial HTML page that links to the application. It's useful to bookmark it on your iPhone for repeated testing.

The save-redirect element generates the page containing the URL-embedded JavaScript application. It simply redirects to the application's data URL. When a user adds this page to his/her home screen, it will show up just like a normal iPhone application.

To build an offline Echo app using this SDK, run Apache Ant with a command line like the following:

ant -Dbuildfile=example/offline-build.xml

The code above will build the Guess-A-Number example. To build your own applications, simply replace the "example/offline-build.xml" portion of the path with your own. Or if you prefer you can put the whole works in the IDE of your choice and run the main() method of nextapp.echooff.EchoOff, specifying the build file of the application as the first command line paramter in your launch configuration.

For more info on iPhone development, I recommend reading the Apple docs @ http://developer.apple.com/iphone. You'll need to use/create an "AppleID" to access that site.

And, again, please bear in mind that this is only a proof-of-concept which was quickly thrown together. That said, I'm happy to offer any help if you'd like to try it out.

Download: /content/echo3/iphone/echo-off-sdk.0.0.1.zip

Online Application Start Page: /content/echo3/iphone/start.html (NOTE: This application is tested only in Mobile Safari and Firefox. It will definitely not work in any version of Internet Explorer, due to its lack of support for data URLs.)

Comments

tliebeck's picture

One more note: all of this

One more note: all of this is done on a bone-stock 1.1.3 firmware iPhone. No hacks are necessary.

rhinestone jewelry sets

This was a genuinely great post. In theory I’d like to create like this also – getting time and true work to make a good content… but what can I say… I procrastinate alot and in no way appear to get some thing carried out.

---------------------------------------------------
Shopping at <a href="http://www.cifta.com">www.cifta.com</a> you will be able to search through hundreds of <a href="http://www.cifta.com/wholesale-rhinestone-bridal-jewelry-sets/">rhinestone jewelry sets</a><a href="http://www.cifta.com/wholesale-rhinestone-bridal-jewelry-sets/">fashion jewelry sets</a><a href="http://www.cifta.com/wholesale-pearl-bridal-jewelry-sets/">pearl necklace sets</a><a href="http://www.cifta.com/wholesale-pearl-bridal-jewelry-sets/">bridal party jewelry sets</a><a href="http://www.cifta.com/wholesale-pearl-bridal-jewelry-sets/">wedding jewelry sets for brides</a> and seek out great deals. We carry gold, silver, gemstone and stainless steel jewelry for men and women.Limitless combination of stones and styles include matching jewelry bands.

HTC?

I agree great post. Does it work for HTC phones?

Office Furniture

Beta2 is a complete

Beta2 is a complete re-imagining of EchoStudio for Echo3. The Form and StyleSheet editors have been redesigned, and now provide support for undo/redo along with faster and easier property editing. The product has been moved from a downloadable plugin to a proper Eclipse update site, such that users can easily upgrade to later releases.thank you,,.
Billige solbriller

well this SDK allows the

well this SDK allows the developer to configure an application build using an XML file and i will try this application on my new android phone.
Bollywood Movies

great of you to share

So great of you to share.
I was thinking about this but you have helped me out.
laura hennings

My point of view

I just can’t stop reading this. Its so fresh, so filled with updates that I just didn’t know.I am delighted to see that people are in fact writing about this subject in such a elegant way, presenting us all diverse parts to it.You’re a fine blogger.Please carry on with it.I can’t wait to read what’s after that.

office password recovery pro

Removal Services

We provide removal quotes for those seeking professional <a href="http://www.removalmarket.co.uk/">Removal Services</a>. Fill in one form to get non-obligatory and comparative Removal Quotes from leading removal companies.

Amazing post and everyone

Amazing post and everyone has submit their mature views regarding this,I very interested in the article,people pay more attention to high quality life style. High quality means ,comfortable and healthy,Thanks for sharing the info.Regards,renamer

Excellent tutorial that will

Excellent tutorial that will provide the incentive and basis for my internet marketing strategies. I wonder if I can mention the article as a bibliographic reference in my work. Thanks!

application's data UR

The save-redirect element generates the page containing the URL-embedded JavaScript application. It simply redirects to the application's data URL. When a user adds this page to his/her home screen, it will show up just like a normal iPhone application.

<a href="http://www.stonemanvacationvillas.com">accommodation near Disney</a>

this good post Would you

this good post Would you please post an article about making templates for new version of blogger Something like your template Regards.Canvas Prints It is really nice, but could you tell me how should I use this code, it realy good blog thanks.

nabiha

This is a great blog with excellent posts and links.
Thanks for sharing.
Same Day Flower Delivery in UK

Nice post for all Car Finder

Nice post for all Car Finder must read it

I bought a screen for the

I bought a screen for the iphone 3gs then i realized i have the iphone 3g.How to identify the difference iphone 3g and an iphone 3gs?

Regards,
800 Numbers

website designing

It is used as a general term to describe to creating and involve in any type of web page.The intent of web design is to create a website—a collection of online content including documents and applications that reside on a Web server/servers. website designing The website may include text, images, sounds and other content, and may be interactive. Web design is a broad term used to encompass the way that content (usually hypertext or hypermedia) that are delivered to an end-user through the World Wide Web, using a Web browser.

Krestianstvo SDK is built on

Krestianstvo SDK is built on top of OpenCroquet SDK with preloaded packages (some of the list: Sophie XUL-CSS, Seaside, OMeta, and Krestianstvo itself). It is mainly developed in Russian language using unicode characters just in comiled methods and class definitions. The SDK is updated through the change set's update stream and source code could be easily filed in/filed out containing unicode chars as well. kitchen cabinets Los Angeles

Hello, you can create real

Hello,

you can create real applications that can run ECHO3 even when the phone is out of reach of the network.great applications.

Thanks,
<a href="http://christian-neeser.com/">Christian Neeser</a>

it really most amazing

it really most amazing gadget.its good i am thank full to you Moving Boxes nice post here for all

it really most amazing

it really most amazing gadget.its good i am thank full to you Car Finder
its amazing for this century.Hi, It is really nice, but could you tell me how

should I use this code,thanks for this information.

nice

am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post.
Literature Racks

we provide the best of free

we provide the best of free Joomla 1.6 templates and offer you a wide variety of resources for your Joomla driven websites.
joomla 1.6 templates

Thanks for this read mate.

Thanks for this read mate. Well, this is my first visit to your blog! But I admire the precious time and effort you put into it, especially into interesting articles you share here! web design services

sell your cell phone online

If you have a phone that's less than two years old, it's a good bet you can get rid of it. It seems like every few months, a new model that does even more than previous one is introduced. People flock to get the latest and greatest models, but their old ones sit around and collect dust. You can quickly sell your cell phone online and use the proceeds to pay for your next month's service!Why keep your old, out of date cell lying around? Why not take advantage of the opportunity to get a few bucks? Some places are taking any model, in any condition, even if it's broken. This is usually because they can reuse some of the parts. It's obviously better for the environment than all of those phones ending up in the landfill. In all honesty, it probably won't be more than a few months and you'll want another model anyway! http://www.cash4phones.com/sell-cell-phones.aspx

These apps for iPhone look

These apps for iPhone look awesome! Thanks for references! custom papers

Airlines lease aircraft from

Airlines lease aircraft from other airlines or leasing companies for two main reasons; to operate aircraft without the financial burden of buying them, and to provide temporary increase in capacity.Aircraft Insurance The industry has two main leasing types, wet leasing which is normally used for short term leasing and dry leasing which is more normal for the longer term leases.

Its Relly Nice...

Wolfe spends four hours a day with his orchids. Clients must accommodate themselves to this schedule," wrote Rex Stout's biographer John J. McAleer. "Rex does not use the orchid schedule to gloss over gummy plotting.
Silk Orchid flowers Like the disciplines the sonneteer is bound by, the schedule is part of the framework he is committed to work within. The orchids and the orchid rooms sometimes are focal points in the stories. They are never irrelevant. In forty years Wolfe has scarcely ever shortened an orchid schedule

Its Amazing...

By negotiating debts on their own, debtors are able to save in fees that would otherwise be paid to a debt settlement company or an attorney.
Debt Settlement Company This option also gives the debtor more control over the process which may, or may not, be a motivational factor to continue successfully completing the process.

Eine Günstige private

It is obviously that selling

It is obviously that selling informative products online is perfectly fit to the affiliate marketing business .send flowers switzerland || send flowers to Chennai