Showing posts with label Mobile tools. Show all posts
Showing posts with label Mobile tools. Show all posts

Tuesday, March 5, 2013

Build cross platform mobile application with jQ.Mobi and PhoneGap

 

Introduction

In this blog post we’ll learn how to build a mobile application for multiple platforms by using JavaScript library called jQ.Mobi and PhoneGap cloud build service.

In the first part, there will be shown steps of building a “Hello, world” mobile application in HTML5/JavaScript/CSS3. This will be done by using free jQ.Mobi library that allow us to build application with native look&feel of the specific platforms in very easy way.

The second part will describe how to use PhoneGap cloud build service which allow us to build our previous “Hello, world” project for multiple platforms. What this service is providing, is it will build executable install files for each of the platforms: iOS, Android, WP, Blackberry, HP and Symbian.

Part 01 – “Hello, world”

Firstly, download jQ.Mobi library from GitHub link just by clicking ZIP button. After download finishes, extract the archive.

Now create a separate folder for your new “Hello, world” project. Inside the directory create another directory named “www”. Copy plugins, kitchensink and ui folders from extracted jQ.Mobi folder. Also, copy jq.mobi.js and jq.mobi.min.js. In the “www” folder, create index.html empty file. Now the current folder structure should look like this:

directory structure

Picture 01 – Project directory structure

Now we’ll edit our index.html file with the following code:

<!DOCTYPE html>
<!--HTML5 doctype-->
<html>

<head>
<title>jqUi Starter</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />

<link rel="stylesheet" type="text/css" href="kitchensink/icons.css" />
<link rel="stylesheet" type="text/css" href="kitchensink/jq.ui.css" title="volcano"/>

<script type="text/javascript" charset="utf-8" src="ui/jq.ui.min.js"></script>

<script>
if (!((window.DocumentTouch && document instanceof DocumentTouch) || 'ontouchstart' in window)) {
$.os.android = true; //let's make it run like an android device
}

</script>
<script type="text/javascript">

var webRoot = "./";
$.ui.backButtonText = "Back";// We override the back button text to always say "Back"
</script>
</head>

<body>
<div id="jQUi"> <!-- this is the main container div. This way, you can have only part of your app use jqUi -->
<!-- this is the header div at the top -->
<div id="header">

</div>
<div id="content">
<!-- here is where you can add your panels -->
<div title='Welcome' id="main" class="panel">This is a "Hello, world" sample.</div>
<div title="Targeting platforms" id="jqmweb" class="panel" data-header="testheader">
<h2 class='expanded' onclick='showHide(this,"jqweb_info");'>Platforms</h2><p id='jqweb_info'>
We wish to support following platforms:</p>
<ul>
<li>iOS</li>
<li>Android</li>
<li>Windows Phone</li>
<li>Blackberry</li>
<li>HP</li>
<li>Symbian</li>
</ul>
<br/><br/>
</div>
</div>
<!-- bottom navbar. Add additional tabs here -->
<div id="navbar">
<div class="horzRule"></div>
<a href="#main" id='navbar_home' class='icon home'>home</a>
<a href="#jqmweb" id='navbar_target' class='icon target'>target</a>
</div>
</div>
</body>
</html>

 


In the head tag you can see we referenced JavaScript files and CSS from the jQ.Mobi library. There is additional initialization JavaScript that runs first time the app starts. In the body part there are two divs that are loaded depending on button click from the navigation bar (“navbar”). First div with id="main" is the main page, while other div with id="jqmweb" represents the second page with list of items.


TIP: If you want to use Visual Studio for easy project editing, simply go File>Open>Web Site and browse to your project folder.


Now you can test index.html page preview in browser. After you navigate with “home” and “target” buttons you should see slide animation.










mainpage


targetpage


Picture 02 – Main page


Picture 03 – Target page


Now when your “Hello, world” app is done, zip the entire folder to .zip archive.


Part 02 – PhoneGap build service


With your browser go to https://build.phonegap.com/. Login with your Adobe account or GitHub account. If you don’t have account you can go to the GitHub official web site and register for a free account. After you have been logged in:


1. Click on New App button.


phonegap-build01


2. Select Private tab, click Upload a .zip file, browse to your zip project archive and click Ready to build.


phonegap-build02


TIP: For a free use you can only upload 1 zip archive, but instead, you could use GitHub repository and build your application directly from there.


3. After your build is finished you can download executable files for these platforms:


PGBuildApp


TIP: For the iOS case you’ll first need to upload application certificate and build afterwards.

Thursday, June 21, 2012

Create your resource’s icons for Android app with ease

 

Introduction

Android Asset Studio is a part of android-ui-utils project and in essence it is a web site that provides you online tool for generating necessary icons for buttons or menus. This service allows you to automatically and rapidly generate required icons in all sizes you need, and by that you can save a lot of time.

About

If you visit Android Asset Studio web site you will notice two parts. Icon generators contains several categories that allow you to generate icons for particular purpose.

ScreenShot01






Using foreground option you can upload image, use default clipart icons or use text as icon foreground.
Also, you can adjust padding by using percentage scroll to determine width of image margins.
Besides, you can also adjust background shape and color.

After you adjusted your icon look, you can download single image in desired dpi or you can download .zip file that will contain “res” folder with photos of all image sizes.

The second part contains nice online tool called Device frame generators for wrapping your previously taken screenshots of mobile screen. You can use it if you just need to create a couple of screen images to assemble screen flow for your mobile app usage scenario. In this case you will be provided better context for your frames which can be pretty handy. It also allows you to use correct screen resolutions for particular devices. Only requirement is that your image is in exact resolution as it is specified for particular device.

ScreenShot03

 

 

  • Drag&drop image to area for wanted mobile device. Notice that you will need to use image that has exactly the same size as a mobile device’s screen size.
ScreenShot04

 

 

  • After image is loaded you can export it back to your desktop by using drag&drop.