Building Mobile Apps with jQuery Mobile and PhoneGap [Webinar]

In this we­binar, Building Mobile Apps with jQuery Mobile and PhoneGap, you will get a chance to see just how im­proved the new re­lease is. Through a hands-​​on ex­ample in the webinar, you will see how Appery.io lever­ages PhoneGap and jQuery Mobile using a drag-​​and-​​drop vi­sual ed­itor to build and test cross-​​platform, cross-​​device mo­bile Web and na­tive apps that con­sume cloud ser­vices using HTML5, CSS3, and JavaScript.

Building Mobile Apps with jQuery Mobile and PhoneGap
Tuesday, October 11, 2011
11am US Pacific Time
Register: https://​www1​.go​tomeeting​.com/​r​e​g​i​s​t​e​r​/​2​3​6​5​8​1​769

Mobile Apps Builder – You Can Now Try It Free For 30 Days

Appery.io Mobile Apps Builder had just 15-days trial period. We know it wasn’t enough. Starting today the trial period is now 30 days! You don’t need to give us your credit card, just sign up and try it. We are pretty sure you will love it, it’s super easy to build real mobile Web and native apps.

Getting Started with HTML5 Local Storage

HTML5’s local storage is undoubtedly one of the most interesting and most talked about features in the HTML5 technology stack. Local storage is part of Web Storage specification and is supported by all modern browsers (destkop and mobile). Although local storage (or Web Storage) sounds rather sophisticated, the functionality is very easy to use. You basically get a map as storage inside the browser (available to all browser windows). You can insert, delete or read key/value pairs. That’s it. Data stored in local storage (localStorage) will be there when you close and open the browser. There is also session storage (sessionStorage). As the name implies, it will be only available as long as the browser window is open, and will be cleared when browser window is closed.

The only other thing to know is that data saved by a page is only available for a pages from the same domain. In other words, a page loaded from abc.com, doesn’t have access to data saved by page from domain xyz.com.

We are going to going to build an app that looks like the screen shot below. In fact, you can try the app (scan the QR code). Try it on your mobile device as well.

To build the app, I used Appery.io Mobile Apps Builder. If you are wondering why Appery.io? Well, because it’s incredibly simple and fast to create a project and build app. If you don’t have an account yet, quickly sign up here.

First build the UI by dragging and dropping jQuery Mobile components from the palette on to the phone. At any point, you can click Test to try the app in browser, or mobile browser.

You can use Appery.io to build real mobile apps without writing any JavaScript. But, for more advanced cases (like ours), you can easily write any custom JavaScript. You can even import 3rd party JavaScript libraries. In our case, we are going to create a new JavaScript file (called asset) with the following content:

// save item
function save(item) {
  var size = localStorage.length + 1;
  localStorage.setItem('key' + size, item);
}
// get storage content
function storage(){
   var output='';
   for (i=0; i <= localStorage.length - 1; i++)  {  
      key = localStorage.key(i);  
      val = localStorage.getItem(key);  
      if (i == 0) {
         output = val;
      }
      else {
         output = output + '\n' +val;
      }
   }
   return output;
}
// clear storage
function clear () {
   localStorage.clear();
}

There are three functions, one for saving a new item (save()), one for getting the current storage (storage()) and one for clearing the content (clear()). Local storage API is very simple. For example, to save an item:

localStorage.setItem('key', 'item');

then, to get a value from storage:

localStorage.getItem('key');

This is how the complete file looks inside Appery.io JavaScript editor:

The last step is to invoke JavaScript when the buttons are clicked. We also want to load storage content when the screen is loaded for the first time. Let’s work on the buttons first. To invoke JavaScript on button click, we first add click HTML event to the button:

Then we add Run Custom JavaScript action by clicking the + button:

Click on the action to enter JavaScript code. The code for Save to Local Storage button looks like this:

var item =$('[dsid="input"]').val();
save(item);
var output='';
output = storage();
$('[dsid="storageContent"]').text(output);

We first find the input component using jQuery (it’s going to simpler to do that, once we introduce Appery.io JavaScript API, work in progress). Save the value from the input element, reload storage content so we can display it inside the textarea.

Clear Local Storage button looks like this:

clear();
$('[dsid="storageContent"]').text('');
alert('Local storage cleared.');

Lastly, we also add load event to the screen itself so that we can show storage content when the screen loads for the first time:

var output='';
output = storage();
$('[dsid="storageContent"]').text(output);

Try it yourself (it’s easy and fun!).

Appery.io Review in DevProConnections

Using Appery.io and PhoneGap to Build Native Apps

If you don’t know what Appery.io is, Appery.io is a Web-based mobile apps builder or a mobile RAD (Rapid Application Development) tool. It enables developers to build mobile Web and native apps very quickly. Appery.io comes with a visual editor and jQuery Mobile components. You simply drag and drop components into the phone area.

This makes it very easy to prototype and build the UI. Once you have developed the UI (which you can share and test in browser or mobile device), you define and connect to REST services. Once the service is defined, it is mapped to the UI. A service usually has inputs and outputs. Mapping means taking input from UI (such as input component) and using it as input for the service. On the other side, taking service output and mapping it back to the UI, for displaying the result. One last step is usually adding an event to invoke the service. For example, on a button click the service can be invoked. What I just described is a very easy and fast way to build mobile Web apps. There is nothing to setup or configure, just launch the Appery.io visual editor and start building.

Now, how do you get a native app? That’s where PhoneGap comes in. PhoneGap is an open source framework, it wraps your mobile Web app and gives you access to native device API. To use native features, PhoneGap provides very clean and elegant API. For example, to sound a notification beep twice, you need to call the following:

navigator.notification.beep(2);

Simple, right?

To get device information, the following code is used:

alert ('Device Name: '  + device.name     + '\n' + 
     'Device PhoneGap: ' + device.phonegap + '\n' + 
     'Device Platform: ' + device.platform + '\n' + 
     'Device UUID: '     + device.uuid     + '\n' + 
     'Device Version: '  + device.version  + '\n');

Any native mobile project in Appery.io comes configured with PhoneGap version 1.0. How do you invoke this API when building a mobile app in Appery.io? It’s very simple. Appery.io comes with Run Custom JavaScript action which can be invoked on any HTML event. Let’s take a button. When a button is clicked (click event), you add an action (Run Custom JavaScript) to invoke. That’s it. Inside the Run Custom JavaScript, you can run any custom JavaScript.

You start with a button, we will use the Vibrate button:

Add click HTML event to the button:


Add Run Custom JavaScript action:

and finally add PhoneGap JavaScript call:

navigator.notification.vibrate(1000);

Another option is to create a JavaScript file (Project > JavaScript), write all the custom code there in functions and then invoke any function via Run Custom JavaScript action.

JavaScript file:

Invoking a function from the custom JavaScript file:

Once you use native API, testing in Web browser is no longer possible. To make it super easy to test your native app, you can use Appery.io Mobile Tester. It’s a native app (Android, iOS) which lists all your mobile projects created in Appery.io. You simply tap any app and launch the native app. The app looks like this:

Like what you see? Try Appery.io Mobile Apps Builder yourself!

Thanks to Paul Beusterien for the example idea.

Appery.io Prototypes Builder Trials for Beta Users Ending on Sept. 22

Early adopters of Appery.io (reg­is­tered be­fore June 15, 2011) re­ceived a com­pli­men­tary 3-​​month sub­scrip­tion to the Prototypes Builder Professional Plan. On September 22, 2011, this trial pe­riod will end. Starting on September 22, these users will have the fol­lowing op­tions when they log in to Appery.io:

  1. Continue using the Professional Plan with un­lim­ited projects and un­lim­ited screens by pro­viding billing in­for­ma­tion and paying $15/​month/​user going forward.
  2. Downgrade to the Free Plan with ac­cess to your last edited project and 5 screens in the project.
  3. Deactivate your Prototypes Builder ac­count (ac­count data will still be kept for 30 days).

We hope they all choose op­tion #1!

Appery.io Mobile Apps Builder at GigaOM Mobilize

Appery.io Mobile Apps Builder is going to be at GigaOM Mobilize event next week, Sept. 26-27. Attend our workshop and you will learn quickly to build mobile apps in the cloud. A real mobile app will be built during the workshop. Attendees will be able to test/follow the app as it’s being built.

Building Mobile Apps in 5 Easy Steps [Cheat sheet]

Appery.io Mobile Apps Builder Upgrades with Brand New UI, New Export/Build for Android, iOS and Much More

Appery.io Mobile Apps Builder upgrades with brand-new UI and very cool new features.

Brand-new attractive UI

Appery.io Mobile Apps Builder got a new and very attractive UI. You can see how it looks below but the best way to experience it, is to log in or sign up. You will like it.

Upgraded export-and-build capability with support for Android, iOS, and mobile Web

That’s big one. From the screen shot you can see that it’s now super easy to get the source code and build for Android and get the source code for iOS.

Android binary release (.apk) settings editor

What’s really cool is that you get get an Android binary and immediately publish it to the Android Market. How can you do that? Appery.io has a new Android .apk settings editor where you can enter all the information needed for the Android Market.

Upgraded test capability. Quickly test your app in a browser or on a mobile device

The Test screen has been upgraded. It’s now super easy to test the app in desktop Web browser, mobile Web browser, and on the actual device via Appery.io Mobile Tester.

Support added for REST XML services and for using the POST method

REST services are no longer limited to just JSON response format, Appery.io now supports XML. We have also improved ability to make POST requests.

New service “echo” mode makes it possible to test the app without connecting to the actual service

To make it even easier to work with remote services, we have introduced an “echo” or mock service. Basically, instead of making a call to the actual remote service each time during development, you can invoke a local “echo” or mock service which returns a sample of the real data.

Use custom external JavaScript libraries in your app

To make it simpler to customise and use custom JavaScript, we have added a feature where any custom JavaScript library can be loaded and included in the app.

New Appery.io JavaScript framework to make it simpler to extend your apps with custom JavaScript

Check it out here.

Create and use custom JavaScript functions when mapping service data to the UI

When mapping UI when data source, you can now specify custom JavaScript to run when the mapping occurs

Improved support for HTML5 attributes and support for the HTML5 video tag

We have added HTML5 input types, attributes such as placeholder and HTML5 video tag.

New iPad screen layout

We added project template with iPad layout – to make it simple and faster build apps for the most popular tablet.

Sneak Peek of New UI and New Export Feature, Plus Slides