25
Mon, Nov
1 New Articles

Developing Mobile Apps for the IBM i, Part I

Development Tools / Utilities
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Just as there's more than one way to skin a cat, there's more than one way to develop mobile apps for the IBM i.

 

Everywhere you turn these days, people are talking about mobile applications. There is endless chatter about apps for iPads and iPhones, Android-style phones and tablets, and several flavors of BlackBerry, among others. The race is on to get mobile apps built and deployed as quickly as possible. Every time you look up, someone is saying "There's an app for that!"

 

Maybe that's your cue to get started. You just need to sort out the technical details and build a mobile app for yourself or your company. Timing is everything, right? So let's begin.

 

Where does the IBM i fit into the fray? Just as important, where do you as an IBM i software developer fit in?

 

Over the course of two articles, I will provide a solid answer to both questions.

 

First, let's lay some groundwork. There are two basic approaches used to build mobile applications. One is to build your apps using native development methodologies. Another is to create your apps using an HTML5 type of development approach.

 

In this article, we're going to build an HTML5 app that runs on the IBM i HTTP Web server. However, having a basic understanding of each approach is imperative to making a good decision about which approach to employ.

 

Let's take a quick look at both.

Native Development

Native development involves a proprietary development API designed to make the most of the device it was created for.

 

iPad and iPhone use Object C, which has a significant learning curve. You can read about native iOS development at the iOS Dev Center.

 

Android uses Java. You can read about Java development for Android here.

 

BlackBerry uses Java too. Go to the BlackBerry Developer site to read about Java development for BlackBerry.

 

Although native for Android and BlackBerry both use Java, the APIs are completely different. Each has its own specific Java API, each with its own learning curve.

 

Advantages of Native Development

 

Apps written with native code libraries are optimized for the target device.

 

Native apps are built to be deployed to their respective app store:

 

  • Apple App Store
  • Android Marketplace
  • BlackBerry App World

 

Native apps also have direct access to the mobile device's features, such as camera, accelerometer, compass, file system, contacts, storage, geolocation, storage, and push notifications.

 

Disadvantages of Native Development

 

If you decide to build a native app and you want to engage audiences from each native platform, you will have to build the app three times.

 

Three times? Really?

 

As mentioned, each of the native platforms above (iOS, Android, BlackBerry) have completely separate and unique APIs. That means:

 

  • Three substantial learning curves
  • Three development efforts
  • Three testing efforts
  • Three deployment strategies
  • Three maintenance efforts
  • Three distinct support burdens

 

Wow, that's a lot to do!

 

If you're going to build your app for a single device type, it's easier to consider a native solution.

 

However, if you want to build your app for multiple devices or if you prefer more of a mobile Web-style look and feel (note: with HTML5 you can achieve a native appearance too!), then an HTML 5 solution is just what you're looking for.

HTML 5

 

Advantages of HTML5 Development

 

One app can run on multiple devices.

 

HTML5 is easier to learn than any of the native solutions.

  • One learning curve
  • One development effort
  • One testing effort
  • One deployment strategy
  • One maintenance effort
  • One support burden

 

One of the great things about adopting the HTML5 approach to mobile development is that if you have any Web development taking place in your shop, then you already understand at least part of the list above.

 

Note: All three of the device types mentioned in this article support what is known as the WebKit browser. WebKit is the provider of HTML5 support. Google Chrome and Apple Safari are both built on WebKit, as are the browsers running in iPad, iPhone, Android, and BlackBerry devices.

 

It's important to note that the HTML5 approach typically employs CSS, JavaScript, and of course HTML5, staples of a typical Web development setting.

 

Your deployment target (WebKit) is also your debugging platform. Google Chrome and Apple Safari have excellent debugging support, including all of the things that you know and love about the green-screen debugger and more!

 

It's easier to roll out changes to a Web-style app than it is to make changes and redeploy a native-style app. With HTML5, you simply push your changes to production. The next time your users run the app, they have your revisions.

 

All of the benefits of building a native app—including access to device internals (camera, accelerometer, compass, file system, contacts, storage, geolocation, and push notifications) and deploying to the various app stores—are available through a technology called PhoneGap (I'll address this in Part II of this article).

 

Disadvantages of HTML5 Development

 

The biggest knock against the HTML5 approach is performance. Native code is compiled to optimize apps built for a given device, producing more efficient, faster code. While this is true, the real issue with performance for any communications-related application is in the way that data is moved between the client and the server. So whether you're writing a native app or an HTML5 app, you need to be mindful of how much data you're sending and receiving and the impact that has on overall response time.

 

Given the many advantages of using HTML5, plus the huge and growing community of HTML5 mobile developers, HTML5 technology for mobile has reached a level of acceptance that makes it a great choice.

 

As mentioned above, in this article we're going to build an app using the HTML5 approach. Also, we will use the IBM i.

 

In any Web development environment, there are two distinct components that you need to be aware of:

 

  • The Web server—For the IBM i, the HTTP Web server is installed by default and is free. We'll use Valence 3.1 from CNX Corporation to provide RPG support for our mobile application. More info below.
  • The browser—For mobile use, the browser comes with the mobile device. All the modern mobile browsers support HTML5 through the use of WebKit. We'll use Google Chrome to test our app on the PC. We'll also use Sencha Touch 2 from Sencha as the JavaScript library for our sample project. More info below.

 

Software Tools

All of the software tools needed for this article are available free. In order to build the app accompanying this article, you should download them now:

 

Google Chrome

 

Google Chrome is for testing and debugging your app on your PC. You may have it already. If not, download it.

 

Google Chrome is simply the best HTML5 browser available for testing mobile apps on your desktop. It has excellent debugging support and very closely emulates the browser running on your mobile device.

 

073012SalisburyFig1

Figure 1: Download Google Chrome.

 

Sencha Touch 2

 

Sencha Touch 2 is the front-end of your application (the screens for your mobile app). This free JavaScript library has captured considerable market share and momentum in the mobile application development world. We'll use it to build the mobile app portion (front-end) of our application. There are several JavaScript libraries in the mobile application development market, but I've found the Sencha library to be the most complete and well-thought-out mobile development platform available.

 

Sencha Touch 2 will be downloaded below as part of the Valence tool, which you will download next.

 

You will need to download Sencha Touch 2 directly only if you are going to build mobile apps that don't involve RPG or Valence. For instance, if your Web-based language of choice is Java, PHP, C#, or any other non-RPG language, you can download it directly from this link. Otherwise, just download Valence in the next step and you'll be all set.

 

073012SalisburyFig2

Figure 2: Download Sencha Touch 2.


Valence for IBM i

 

Valence for IBM i provides a portal into which desktop Web apps and mobile Web apps can be deployed. Valence is an IBM i-centric Web development platform that supports both desktop and mobile app development. Valence also provides an easy-to-use RPG API to support Web apps (both desktop and mobile) as well as built-in support for Sencha's Ext JS desktop browser apps and Sencha Touch 2's mobile browser apps. Download the free community edition!

 

073012SalisburyFig3

Figure 3: Download Valence.

 

Valence installs on your IBM i in just a few minutes and requires no effort to set up. Run the installation process. It will guide you through the installation steps. Once Valence is installed, point your Google Chrome browser to your IBM i using one of these URLs:

 

http://yourIP/valence/vvlogin.pgm

 

or

 

http://yourIBMiname/valence/vvlogin.pgm

 

Valence supports desktop login and mobile (touch) login. If you log in from your desktop browser, Valence will default to a desktop view. You can see what "touch" view looks like via this URL:

 

http://yourIBMiname/valence/vvlogin.pgm?display=touch

 

Here is a mile-high view of how the downloaded pieces relate to each other:

 

073012SalisburyFig4

Figure 4: All the pieces work together.

 

Here's how the different pieces lay out on your IBMi.

 

The Valence Portal is located on your IFS at /valence-3.1.

 

Sencha Touch 2 is located on your IFS at /valence-3.1/sencha-touch-2.0.0.

 

The files for the customer map app (custmapapp.html and custmapapp.js) will be stored at /valence-3.1/mcpress. (You'll create the mcpress folder later.)

 

The RPG source for CUSTMAPR will be located at VALENCE31/QRPGLESRC.

 

The RPG portion of Valence is stored in the Valence31 library.

 

OK, now that you have everything downloaded and you know how the pieces fit together, let's take a look at the customer map app that we're going to build.

 

Here's the flow of the app:

 

1. When the app starts, a list of customers is displayed on the mobile device.

2. The user taps one of the customers.

3. The customer's address is displayed.

4. In addition to the customer address, a map of the area that the customer is located in is displayed.

5. A back button can be used to return to the customer list.

 

This simple app illustrates a number of common functions that are typical of a touch-based app. We have a list (think subfile), we have a detail screen, and we have a Google map component.

 

Let's take a look at the screenshots:

 

073012SalisburyFig5

Figure 5: Here's our customer list.

 

073012SalisburyFig6

Figure 6: A customer has been selected.

Stay Tuned

There you go! Now you know the basics of how to start. In Part II of this article series, we'll pick up where we left off.

Scott Salisbury
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: