SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
How to build integrated, professional enterprise-grade cross-platform mobile apps 
Build a simple enterprise mobility application with data sync using AngularJS, Backbone or Sencha Touch 
using our simple step by step tutorials. 
Our tutorials demonstrate how to develop a basic “train times” viewing 
application using the AppearIQ API. This includes generation of a boilerplate 
HTML5 hybrid cross-platform app (capable of running on either iOS or 
Android devices), introduction to data formats, application logic, how to 
synchronize data, testing in browsers and on devices. 
The tutorials assume that you already have basic knowledge of HTML and JavaScript. If you feel that you 
need to go through the basics, check out some excellent external tutorials like W3Schools HTML tutorials 
or W3Schools Javascript tutorials. 
Use of the AppearIQ cloud developer platform is free of charge. To access the tutorials click here (links to 
AppearIQ.com developer site). 
The tutorial examples provided here are shared with the Slideshare audience. Readers are encouraged to visit 
www.appeariq.com for access to the full AppearIQ documentation and to review more up to date tutorials (including any 
modifications to this one) as they become available. 
Develop Your First App 
Introduction 
In this tutorial, you will learn how to develop a basic single view AIQ application using the AIQ API. This application will 
display a simple read-only list of trains using the AIQ DataSync module. Remember to consult the API documentation in 
case you get lost or you are not sure what the API being used does. 
This tutorial assumes that you already have basic knowledge of HTML and JavaScript. If you feel that you need to go 
through the basics, don't hesitate to read external tutorials like this and this. 
If you need to see the final application source code at any point, it's available on Github in the Mobile samples repository. 
Just follow the Getting Started guide to deploy it to your device. 
Generate Boilerplate App 
Navigate to a folder in which you want to have your AIQ applications and execute the aiq generate command: 
$ aiq generate -n hello-world
This will create a new folder called hello-world and will put the app content inside this folder. 
Your folder structure will look like this: 
Note: The API implementation stored in the aiq folder is only for testing purposes in order to use it in the local 
web browser and will be replaced by the proper implementation when your application is deployed to a device. 
Keeping this folder in your application structure is not obligatory, though we strongly encourage you to use it and 
test your applications in browser before publishing them to device. 
Note: In this tutorial we skip editing the stylesheet. If you want to know the details on how to apply css styles to the 
application, go to this page. 
Entry Point 
Just like the regular web browser, AIQ client launches the index.html file which comes with the application. This file takes 
responsibility of loading and initializing the AIQ API. 
This is how your Hello World's index file should look like: 
<!DOCTYPE html> 
<html> 
<head> 
<meta charset="utf-8"> 
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, 
maximum-scale=1.0"> 
<meta name="MobileOptimized" content="320"> 
<meta name="HandheldFriendly" content="True"> 
<title>Hello world</title> 
<script type="text/javascript" src="/aiq/aiq-api.js"></script> 
<script type="text/javascript" src="/js/app.js"></script> 
<link type="text/css" rel="stylesheet" href="/css/app.css">
</head> 
<body> 
<h1>Hello world</h1> 
<div id="error"></div> 
<ul id="list"></ul> 
<script> 
document.addEventListener("aiq-ready", HW.aiqReady, false); 
</script> 
</body> 
</html> 
Let's go through the most important parts of it one by one. 
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, 
maximum-scale=1.0"> 
<meta name="MobileOptimized" content="320"> 
<meta name="HandheldFriendly" content="True"> 
Web pages display differently on desktop and mobile browsers. In order to make sure that your application is recognized 
as mobile and display all graphical elements correctly, you should use the viewport property and set it to device width. 
Unfortunately not all devices recognize this property, therefore you must use dedicated fallbacks (MobileOptimized for 
Windows based devices and HandheldFriendly for other proprietary operating systems). 
<script type="text/javascript" src="/aiq/aiq-api.js"></script> 
This declaration imports and initializes the AIQ API. The path remains the same no matter if you run the application in the 
browser or in the AIQ client. After the AIQ APIs are initialized and ready to use, aiq-ready document event is generated. 
<div id="error"></div> 
This DIV tag is a placeholder for errors which might occur while retrieving the documents, like connectivity issues or 
unresponsive backend. It will be referred to by its id, which is safe in this case because it is the only element in the 
application with this identifier. 
<ul id="list"></ul> 
This UL tag is a placeholder for the list of trains. It will be referred to by its id, which is safe in this case because it is the only 
element in the application with this identifier. 
<script> 
document.addEventListener("aiq-ready", HW.aiqReady, false); 
</script> 
AIQ API initialization is not instantaneous because it takes a bit time to initialize all of its components. In order not to 
perform any operation before the API is ready, your must subscribe to aiq-ready event generated when everything is in 
place and safe to use. The aiqReady function is defined in HW namespace in the application logic and will be described in 
the next section of this tutorial. 
Note: Placing this SCRIPT tag right before the closing BODY tag will ensure that the contained code will be 
executed only after the DOM tree is parsed and ready to be worked on.
At this point you have an empty view with a Hello World header on top. 
Data Format 
The next step is to define the data structure on which your application will base. Since this applicaiton will show a train list, 
so each document will represent a single train. Let's create adatasync.json file in mock-data folder as described here 
with the following contents: 
{ 
"documents":[ 
{ 
"_type": "TD.Train", 
"number": "9001" 
}, 
{ 
"_type": "TD.Train", 
"number": "9002" 
}, 
{ 
"_type": "TD.Train", 
"number": "9003" 
}, 
{ 
"_type": "TD.Train", 
"number": "9004" 
}, 
{ 
"_type": "TD.Train", 
"number": "9005" 
}, 
{ 
"_type": "TD.Train", 
"number": "9006" 
}, 
{ 
"_type": "TD.Train", 
"number": "9007" 
}, 
{ 
"_type": "TD.Train", 
"number": "9008" 
} 
] 
} 
The _type field is used throughout the whole AIQ system and specifies the type of the document. Document types are 
arbitrary but we encourage you to use prefixes implying an application to which these documents belong (the overall 
namespace in this example is HW. Note however that we're using TD in the data format, which stands for Train Damage. 
The reason for this is that the business data is shared between different sample applications). This reduces the possibility 
of naming conflicts. 
Application Logic 
After the AIQ API is ready to use, you can start populating the initially empty view with some data. This is the example 
app.js file which you will be using in this tutorial: 
/* global AIQ:false, HW:true */ 
var HW = HW || {}; 
(function() { 
"use strict";
HW.aiqReady = function() { 
aiq.datasync.getDocuments("TD.Train", { 
success: function(docs) { 
if (docs.length === 0) { 
this.error({ 
message: "No documents to display" 
}); 
} else { 
var fragment = document.createDocumentFragment(); 
var list = document.getElementById("list"); 
docs.forEach(function(doc) { 
var entry = document.createElement("li"); 
entry.innerHTML = doc.number; 
fragment.appendChild(entry); 
}); 
list.appendChild(fragment); 
} 
}, 
error: function(arg) { 
var error = document.getElementById("error"); 
error.innerHTML = arg.message; 
} 
}); 
}; 
}()); 
Let's try to understand what's going on in this piece of code. 
Retrieving Documents 
In order to retrieve a list of our TD.Train documents, we use getDocuments method of theData Synchronization module. 
aiq.datasync.getDocuments("TD.Train", { 
success: function(docs) { 
... 
}, 
error: function(arg) { 
... 
} 
}); 
Handling Empty List 
To simplify things, we use the error handler to display an information when the document list is empty. 
if (docs.length === 0) { 
this.error({ 
message: "No documents to display" 
}); 
} else { 
... 
} 
Note: Note that we can use "this" in this context because it will point to the object containing both "success" and 
"error" methods. 
Populating the List 
In this line, we retrieve the list element declared in the entry point. We can do this easily thanks to the id we assigned to it.
var list = document.getElementById("list"); 
Then, we need to populate the list with the names of our trains. We know that all documents of TD.Train type have a field 
called number, so we go through the available documents, create a new LI element for every train number and append 
them to our list. 
docs.forEach(function(doc) { 
var entry = document.createElement("li"); 
entry.innerHTML = doc.number; 
fragment.appendChild(entry); 
}); 
Error Proofing 
While it is not obligatory, we advise to use code quality tools like JSHint to make sure that your very liberal by default 
JavaScript code doesn't contain common and easy to overlook mistakes, like using undeclared variables. The "global" 
section 
declares static objects used in the file (their boolean values tell whether they can be changed from within the file). For a 
comprehensive list of available options, visit this page). Note that there is no space after the opening comment. 
/*global AIQ:false, HW:true */ 
Using strict modeis is another way of making the code more error proof. Some browsers implement the strict mode which 
makes the JavaScript parser much less liberal and thus making it easy to spot mistakes. If a browser doesn't support this 
mode, this declaration is treated as a regular string, not causing any problems. 
"use strict"; 
Testing in Browser 
Now your application is ready for the initial testing. The simplest is to test it in Google Chrome to start with. After having 
setup your environment following those guidelines, you should see the following view:
You can see that the list has been populated with eight trains included in the test data. 
Testing on Device 
Testing on a device is explained here. After uploading the application, launch the mobile client and click on the new Hello 
World application that appeared on the home screen. You should see the familiar view containing eight trains:
This is it. Now you have a working example on how to create a simple application and integrate it with the AIQ API. 
Conclusion 
In this tutorial you have learned how to design the business data, create an AIQ enabled application and test it in both local 
browser and on a real device. If you want to learn about more advanced functions like editing documents, using camera or 
performing direct calls, visit our Development Home.

Más contenido relacionado

La actualidad más candente

How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Restshravan kumar chelika
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingAgile Testing Alliance
 
React native app with type script tutorial
React native app with type script tutorialReact native app with type script tutorial
React native app with type script tutorialKaty Slemon
 
An R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data ProductsAn R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data ProductsWei Zhong Toh
 
User hook implemantation sample example
User hook implemantation  sample exampleUser hook implemantation  sample example
User hook implemantation sample exampleAshish Harbhajanka
 
Crash Course on R Shiny Package
Crash Course on R Shiny Package Crash Course on R Shiny Package
Crash Course on R Shiny Package Rohit Dubey
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial IntroPamela Fox
 
ShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor package
ShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor packageShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor package
ShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor packageSean Davis
 
Using Page Objects
Using Page ObjectsUsing Page Objects
Using Page ObjectsGetch88
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMAdobeMarketingCloud
 
AI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedAI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedMarvin Heng
 
Synapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldSynapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldTarunsingh198
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesMohammad Shaker
 
Web application development process
Web application development processWeb application development process
Web application development processJohn Smith
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RPaul Richards
 

La actualidad más candente (20)

How to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR RestHow to convert custom plsql to web services-Soap OR Rest
How to convert custom plsql to web services-Soap OR Rest
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
 
React native app with type script tutorial
React native app with type script tutorialReact native app with type script tutorial
React native app with type script tutorial
 
Chapter 09
Chapter 09Chapter 09
Chapter 09
 
An R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data ProductsAn R shiny demo for IDA MOOC facilitation, Developing Data Products
An R shiny demo for IDA MOOC facilitation, Developing Data Products
 
User hook implemantation sample example
User hook implemantation  sample exampleUser hook implemantation  sample example
User hook implemantation sample example
 
Crash Course on R Shiny Package
Crash Course on R Shiny Package Crash Course on R Shiny Package
Crash Course on R Shiny Package
 
OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
 
ShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor package
ShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor packageShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor package
ShinySRAdb: an R package using shiny to wrap the SRAdb Bioconductor package
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
Using Page Objects
Using Page ObjectsUsing Page Objects
Using Page Objects
 
Angular js
Angular jsAngular js
Angular js
 
Mvc by asp.net development company in india - part 2
Mvc by asp.net development company in india  - part 2Mvc by asp.net development company in india  - part 2
Mvc by asp.net development company in india - part 2
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Hilt Annotations
Hilt AnnotationsHilt Annotations
Hilt Annotations
 
AI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You TypedAI: Mobile Apps That Understands Your Intention When You Typed
AI: Mobile Apps That Understands Your Intention When You Typed
 
Synapseindia android apps introduction hello world
Synapseindia android apps introduction hello worldSynapseindia android apps introduction hello world
Synapseindia android apps introduction hello world
 
Android L08 - Google Maps and Utilities
Android L08 - Google Maps and UtilitiesAndroid L08 - Google Maps and Utilities
Android L08 - Google Maps and Utilities
 
Web application development process
Web application development processWeb application development process
Web application development process
 
Introduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in RIntroduction to Shiny for building web apps in R
Introduction to Shiny for building web apps in R
 

Similar a How to build integrated, professional enterprise-grade cross-platform mobile apps

The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...marcocasario
 
ANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schkannikadg
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's Howmrdon
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog SampleSkills Matter
 
API Integration in Web Application
API Integration in Web ApplicationAPI Integration in Web Application
API Integration in Web Applicationijtsrd
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical WritingSarah Maddox
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questionsAkhil Mittal
 
AngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPIAngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPIEric Wise
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Katy Slemon
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sOrtus Solutions, Corp
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Lookrumsan
 
Apache Shindig, from Server Side Portlets to Open Social Gadgets
Apache Shindig, from Server Side Portlets to Open Social GadgetsApache Shindig, from Server Side Portlets to Open Social Gadgets
Apache Shindig, from Server Side Portlets to Open Social GadgetsTyrell Perera
 
Eclipse e4 Overview
Eclipse e4 OverviewEclipse e4 Overview
Eclipse e4 OverviewLars Vogel
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration{item:foo}
 

Similar a How to build integrated, professional enterprise-grade cross-platform mobile apps (20)

The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
The ActionScript Conference 08, Singapore - Developing ActionScript 3 Mash up...
 
ANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 schANGULAR JS LAB MANUAL(final) vtu2021 sch
ANGULAR JS LAB MANUAL(final) vtu2021 sch
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's How
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
 
Gears User Guide
Gears User GuideGears User Guide
Gears User Guide
 
API Integration in Web Application
API Integration in Web ApplicationAPI Integration in Web Application
API Integration in Web Application
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
 
AngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPIAngularJS Fundamentals + WebAPI
AngularJS Fundamentals + WebAPI
 
sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api's
 
Google Cloud Platform
Google Cloud Platform Google Cloud Platform
Google Cloud Platform
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Look
 
Angular js
Angular jsAngular js
Angular js
 
Apache Shindig, from Server Side Portlets to Open Social Gadgets
Apache Shindig, from Server Side Portlets to Open Social GadgetsApache Shindig, from Server Side Portlets to Open Social Gadgets
Apache Shindig, from Server Side Portlets to Open Social Gadgets
 
Flask
FlaskFlask
Flask
 
Eclipse e4 Overview
Eclipse e4 OverviewEclipse e4 Overview
Eclipse e4 Overview
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration
 

Más de Appear

Improving the efficiency of aircraft turnaround
Improving the efficiency of aircraft turnaroundImproving the efficiency of aircraft turnaround
Improving the efficiency of aircraft turnaroundAppear
 
Appear IQ The Business Case for hybrid html5 mobile apps
Appear IQ The Business Case for hybrid html5 mobile appsAppear IQ The Business Case for hybrid html5 mobile apps
Appear IQ The Business Case for hybrid html5 mobile appsAppear
 
White Paper - Securing Mobile Access to enterprise data
White Paper - Securing Mobile Access to enterprise dataWhite Paper - Securing Mobile Access to enterprise data
White Paper - Securing Mobile Access to enterprise dataAppear
 
Appear IQ8 - Mobility. Made Simple. What we do
Appear IQ8 - Mobility. Made Simple. What we doAppear IQ8 - Mobility. Made Simple. What we do
Appear IQ8 - Mobility. Made Simple. What we doAppear
 
Webinar 5 challenges of mobilization april 9 2014
Webinar   5 challenges of mobilization april 9 2014Webinar   5 challenges of mobilization april 9 2014
Webinar 5 challenges of mobilization april 9 2014Appear
 
MobiCloud Transport Webinar Series - Die vernetzten ÖPNV-Mitarbeiter
MobiCloud Transport Webinar Series - Die vernetzten ÖPNV-MitarbeiterMobiCloud Transport Webinar Series - Die vernetzten ÖPNV-Mitarbeiter
MobiCloud Transport Webinar Series - Die vernetzten ÖPNV-MitarbeiterAppear
 
Webinar: Learn how to migrate mobile workers to next generation mobility
Webinar: Learn how to migrate mobile workers to next generation mobilityWebinar: Learn how to migrate mobile workers to next generation mobility
Webinar: Learn how to migrate mobile workers to next generation mobilityAppear
 
Webinar: The Enterrpise Appstore - What is it and why you need it.
Webinar: The Enterrpise Appstore - What is it and why you need it.Webinar: The Enterrpise Appstore - What is it and why you need it.
Webinar: The Enterrpise Appstore - What is it and why you need it.Appear
 
Integrating Mobile Technology in the Construction Industry
Integrating Mobile Technology in the Construction IndustryIntegrating Mobile Technology in the Construction Industry
Integrating Mobile Technology in the Construction IndustryAppear
 
Gartner Catalyst: MobiCloud presentation
Gartner Catalyst: MobiCloud presentationGartner Catalyst: MobiCloud presentation
Gartner Catalyst: MobiCloud presentationAppear
 
MobiCloud Transport Webinar series June 2013 - Dutch
MobiCloud Transport Webinar series June 2013 - DutchMobiCloud Transport Webinar series June 2013 - Dutch
MobiCloud Transport Webinar series June 2013 - DutchAppear
 
MobiCloud Transport Webinar series June 2013 - English
MobiCloud Transport Webinar series June 2013 - English MobiCloud Transport Webinar series June 2013 - English
MobiCloud Transport Webinar series June 2013 - English Appear
 
MobiCloud Transport Webinar series June 2013 - Swedish
MobiCloud Transport Webinar series June 2013 - SwedishMobiCloud Transport Webinar series June 2013 - Swedish
MobiCloud Transport Webinar series June 2013 - SwedishAppear
 

Más de Appear (13)

Improving the efficiency of aircraft turnaround
Improving the efficiency of aircraft turnaroundImproving the efficiency of aircraft turnaround
Improving the efficiency of aircraft turnaround
 
Appear IQ The Business Case for hybrid html5 mobile apps
Appear IQ The Business Case for hybrid html5 mobile appsAppear IQ The Business Case for hybrid html5 mobile apps
Appear IQ The Business Case for hybrid html5 mobile apps
 
White Paper - Securing Mobile Access to enterprise data
White Paper - Securing Mobile Access to enterprise dataWhite Paper - Securing Mobile Access to enterprise data
White Paper - Securing Mobile Access to enterprise data
 
Appear IQ8 - Mobility. Made Simple. What we do
Appear IQ8 - Mobility. Made Simple. What we doAppear IQ8 - Mobility. Made Simple. What we do
Appear IQ8 - Mobility. Made Simple. What we do
 
Webinar 5 challenges of mobilization april 9 2014
Webinar   5 challenges of mobilization april 9 2014Webinar   5 challenges of mobilization april 9 2014
Webinar 5 challenges of mobilization april 9 2014
 
MobiCloud Transport Webinar Series - Die vernetzten ÖPNV-Mitarbeiter
MobiCloud Transport Webinar Series - Die vernetzten ÖPNV-MitarbeiterMobiCloud Transport Webinar Series - Die vernetzten ÖPNV-Mitarbeiter
MobiCloud Transport Webinar Series - Die vernetzten ÖPNV-Mitarbeiter
 
Webinar: Learn how to migrate mobile workers to next generation mobility
Webinar: Learn how to migrate mobile workers to next generation mobilityWebinar: Learn how to migrate mobile workers to next generation mobility
Webinar: Learn how to migrate mobile workers to next generation mobility
 
Webinar: The Enterrpise Appstore - What is it and why you need it.
Webinar: The Enterrpise Appstore - What is it and why you need it.Webinar: The Enterrpise Appstore - What is it and why you need it.
Webinar: The Enterrpise Appstore - What is it and why you need it.
 
Integrating Mobile Technology in the Construction Industry
Integrating Mobile Technology in the Construction IndustryIntegrating Mobile Technology in the Construction Industry
Integrating Mobile Technology in the Construction Industry
 
Gartner Catalyst: MobiCloud presentation
Gartner Catalyst: MobiCloud presentationGartner Catalyst: MobiCloud presentation
Gartner Catalyst: MobiCloud presentation
 
MobiCloud Transport Webinar series June 2013 - Dutch
MobiCloud Transport Webinar series June 2013 - DutchMobiCloud Transport Webinar series June 2013 - Dutch
MobiCloud Transport Webinar series June 2013 - Dutch
 
MobiCloud Transport Webinar series June 2013 - English
MobiCloud Transport Webinar series June 2013 - English MobiCloud Transport Webinar series June 2013 - English
MobiCloud Transport Webinar series June 2013 - English
 
MobiCloud Transport Webinar series June 2013 - Swedish
MobiCloud Transport Webinar series June 2013 - SwedishMobiCloud Transport Webinar series June 2013 - Swedish
MobiCloud Transport Webinar series June 2013 - Swedish
 

Último

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 

Último (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

How to build integrated, professional enterprise-grade cross-platform mobile apps

  • 1. How to build integrated, professional enterprise-grade cross-platform mobile apps Build a simple enterprise mobility application with data sync using AngularJS, Backbone or Sencha Touch using our simple step by step tutorials. Our tutorials demonstrate how to develop a basic “train times” viewing application using the AppearIQ API. This includes generation of a boilerplate HTML5 hybrid cross-platform app (capable of running on either iOS or Android devices), introduction to data formats, application logic, how to synchronize data, testing in browsers and on devices. The tutorials assume that you already have basic knowledge of HTML and JavaScript. If you feel that you need to go through the basics, check out some excellent external tutorials like W3Schools HTML tutorials or W3Schools Javascript tutorials. Use of the AppearIQ cloud developer platform is free of charge. To access the tutorials click here (links to AppearIQ.com developer site). The tutorial examples provided here are shared with the Slideshare audience. Readers are encouraged to visit www.appeariq.com for access to the full AppearIQ documentation and to review more up to date tutorials (including any modifications to this one) as they become available. Develop Your First App Introduction In this tutorial, you will learn how to develop a basic single view AIQ application using the AIQ API. This application will display a simple read-only list of trains using the AIQ DataSync module. Remember to consult the API documentation in case you get lost or you are not sure what the API being used does. This tutorial assumes that you already have basic knowledge of HTML and JavaScript. If you feel that you need to go through the basics, don't hesitate to read external tutorials like this and this. If you need to see the final application source code at any point, it's available on Github in the Mobile samples repository. Just follow the Getting Started guide to deploy it to your device. Generate Boilerplate App Navigate to a folder in which you want to have your AIQ applications and execute the aiq generate command: $ aiq generate -n hello-world
  • 2. This will create a new folder called hello-world and will put the app content inside this folder. Your folder structure will look like this: Note: The API implementation stored in the aiq folder is only for testing purposes in order to use it in the local web browser and will be replaced by the proper implementation when your application is deployed to a device. Keeping this folder in your application structure is not obligatory, though we strongly encourage you to use it and test your applications in browser before publishing them to device. Note: In this tutorial we skip editing the stylesheet. If you want to know the details on how to apply css styles to the application, go to this page. Entry Point Just like the regular web browser, AIQ client launches the index.html file which comes with the application. This file takes responsibility of loading and initializing the AIQ API. This is how your Hello World's index file should look like: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta name="MobileOptimized" content="320"> <meta name="HandheldFriendly" content="True"> <title>Hello world</title> <script type="text/javascript" src="/aiq/aiq-api.js"></script> <script type="text/javascript" src="/js/app.js"></script> <link type="text/css" rel="stylesheet" href="/css/app.css">
  • 3. </head> <body> <h1>Hello world</h1> <div id="error"></div> <ul id="list"></ul> <script> document.addEventListener("aiq-ready", HW.aiqReady, false); </script> </body> </html> Let's go through the most important parts of it one by one. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta name="MobileOptimized" content="320"> <meta name="HandheldFriendly" content="True"> Web pages display differently on desktop and mobile browsers. In order to make sure that your application is recognized as mobile and display all graphical elements correctly, you should use the viewport property and set it to device width. Unfortunately not all devices recognize this property, therefore you must use dedicated fallbacks (MobileOptimized for Windows based devices and HandheldFriendly for other proprietary operating systems). <script type="text/javascript" src="/aiq/aiq-api.js"></script> This declaration imports and initializes the AIQ API. The path remains the same no matter if you run the application in the browser or in the AIQ client. After the AIQ APIs are initialized and ready to use, aiq-ready document event is generated. <div id="error"></div> This DIV tag is a placeholder for errors which might occur while retrieving the documents, like connectivity issues or unresponsive backend. It will be referred to by its id, which is safe in this case because it is the only element in the application with this identifier. <ul id="list"></ul> This UL tag is a placeholder for the list of trains. It will be referred to by its id, which is safe in this case because it is the only element in the application with this identifier. <script> document.addEventListener("aiq-ready", HW.aiqReady, false); </script> AIQ API initialization is not instantaneous because it takes a bit time to initialize all of its components. In order not to perform any operation before the API is ready, your must subscribe to aiq-ready event generated when everything is in place and safe to use. The aiqReady function is defined in HW namespace in the application logic and will be described in the next section of this tutorial. Note: Placing this SCRIPT tag right before the closing BODY tag will ensure that the contained code will be executed only after the DOM tree is parsed and ready to be worked on.
  • 4. At this point you have an empty view with a Hello World header on top. Data Format The next step is to define the data structure on which your application will base. Since this applicaiton will show a train list, so each document will represent a single train. Let's create adatasync.json file in mock-data folder as described here with the following contents: { "documents":[ { "_type": "TD.Train", "number": "9001" }, { "_type": "TD.Train", "number": "9002" }, { "_type": "TD.Train", "number": "9003" }, { "_type": "TD.Train", "number": "9004" }, { "_type": "TD.Train", "number": "9005" }, { "_type": "TD.Train", "number": "9006" }, { "_type": "TD.Train", "number": "9007" }, { "_type": "TD.Train", "number": "9008" } ] } The _type field is used throughout the whole AIQ system and specifies the type of the document. Document types are arbitrary but we encourage you to use prefixes implying an application to which these documents belong (the overall namespace in this example is HW. Note however that we're using TD in the data format, which stands for Train Damage. The reason for this is that the business data is shared between different sample applications). This reduces the possibility of naming conflicts. Application Logic After the AIQ API is ready to use, you can start populating the initially empty view with some data. This is the example app.js file which you will be using in this tutorial: /* global AIQ:false, HW:true */ var HW = HW || {}; (function() { "use strict";
  • 5. HW.aiqReady = function() { aiq.datasync.getDocuments("TD.Train", { success: function(docs) { if (docs.length === 0) { this.error({ message: "No documents to display" }); } else { var fragment = document.createDocumentFragment(); var list = document.getElementById("list"); docs.forEach(function(doc) { var entry = document.createElement("li"); entry.innerHTML = doc.number; fragment.appendChild(entry); }); list.appendChild(fragment); } }, error: function(arg) { var error = document.getElementById("error"); error.innerHTML = arg.message; } }); }; }()); Let's try to understand what's going on in this piece of code. Retrieving Documents In order to retrieve a list of our TD.Train documents, we use getDocuments method of theData Synchronization module. aiq.datasync.getDocuments("TD.Train", { success: function(docs) { ... }, error: function(arg) { ... } }); Handling Empty List To simplify things, we use the error handler to display an information when the document list is empty. if (docs.length === 0) { this.error({ message: "No documents to display" }); } else { ... } Note: Note that we can use "this" in this context because it will point to the object containing both "success" and "error" methods. Populating the List In this line, we retrieve the list element declared in the entry point. We can do this easily thanks to the id we assigned to it.
  • 6. var list = document.getElementById("list"); Then, we need to populate the list with the names of our trains. We know that all documents of TD.Train type have a field called number, so we go through the available documents, create a new LI element for every train number and append them to our list. docs.forEach(function(doc) { var entry = document.createElement("li"); entry.innerHTML = doc.number; fragment.appendChild(entry); }); Error Proofing While it is not obligatory, we advise to use code quality tools like JSHint to make sure that your very liberal by default JavaScript code doesn't contain common and easy to overlook mistakes, like using undeclared variables. The "global" section declares static objects used in the file (their boolean values tell whether they can be changed from within the file). For a comprehensive list of available options, visit this page). Note that there is no space after the opening comment. /*global AIQ:false, HW:true */ Using strict modeis is another way of making the code more error proof. Some browsers implement the strict mode which makes the JavaScript parser much less liberal and thus making it easy to spot mistakes. If a browser doesn't support this mode, this declaration is treated as a regular string, not causing any problems. "use strict"; Testing in Browser Now your application is ready for the initial testing. The simplest is to test it in Google Chrome to start with. After having setup your environment following those guidelines, you should see the following view:
  • 7. You can see that the list has been populated with eight trains included in the test data. Testing on Device Testing on a device is explained here. After uploading the application, launch the mobile client and click on the new Hello World application that appeared on the home screen. You should see the familiar view containing eight trains:
  • 8.
  • 9. This is it. Now you have a working example on how to create a simple application and integrate it with the AIQ API. Conclusion In this tutorial you have learned how to design the business data, create an AIQ enabled application and test it in both local browser and on a real device. If you want to learn about more advanced functions like editing documents, using camera or performing direct calls, visit our Development Home.