The use of open-source code in mobile app development is exploding. Flexibility, increased innovation and shorter development times are just three reasons developers are turning more frequently to open source.

According to the sixth annual Future of Open Source Survey, recently conducted by North Bridge Venture Partners and Black Duck Software in conjunction with The 451 Group, open-source software (OSS) investment increased by 49% to US$675 million in 2011. The quality of open source—and the ability to continuously improve it—are two of the top reasons for its adoption, the survey said.

With more than 10,000 new mobile open-source projects launched in 2011 (bringing the cumulative total to over 18,000, according to Black Duck’s KnowledgeBase), the use of open-source software in mobile app development shows no signs of slowing down.

“Open source is the foundation for mission-critical apps in the enterprise,” said Rod Cope, founder and CTO of OpenLogic, a provider of enterprise open-source software scanning and governance solutions. “Nearly all mobile developers are now using open source.”

“There’s so much good code available in the public domain,” added Mahshad Koohgoli, CEO of Protecode, a provider of open-source license-management solutions. “Good developers don’t write code from scratch anymore; they know how to find that code.”

This trend of using open-source code in mobile app development is bringing to light new legal responsibilities and design considerations for app developers. As a developer, you should know the following best practices for successfully using open-source code in mobile apps.

One best practice is to choose a basic development approach at design time. “The first step is to evaluate the size and depth of your project,” said Dave Gruber, director of developer relations at Black Duck, a provider of solutions for automating the management, governance and secure use of open-source software. “Decide early on just how much code you will do natively and how many open-source components you plan to use in your mobile app.”

Another best practice is to learn your company’s open-source license policy before you begin development. “Your company should have an open-source license policy set in place,” said Gruber. “Make sure you understand the policy so as to avoid a negative code audit at build time. Know if you will be using the Apache license, the Mozilla license or other licenses.”

Do you know which open-source licenses your company wants you to comply with? There are thousands of licenses in existence, so it’s important to find out. Among the most popular open-source licenses are the Apache License, the Mozilla Public License, the GNU General Public License (GPL), and the GNU Lesser General Public License (LGPL). The GNU Project (a free-software, mass-collaboration project) offers a list of GPL-compatible free software licenses on its website.
#!
Comply with open-source licenses
One of the most important best practices is to comply with open-source licenses, and not everyone is doing this. OpenLogic conducted research last year and found that 71% of Android, iPhone and iPad apps using open-source software licensed under the Apache, GPL and LGPL failed to comply.

open-source mobile apps

This is a problem. If you try to distribute your mobile app without having complied with the necessary licenses, you may face negative consequences. One such consequence is working hard on your mobile app only to see it get refused by (or taken down from) Apple’s App Store, Google’s Android Marketplace, the Windows Marketplace, and other app stores.

But open-source license compliance is not only a smart idea for developers who wish to avoid these negative consequences; it is good for the open-source community itself.

“Open-source developers wish to maintain the integrity of their code, and receive attribution for their work, by utilizing one of the open-source licensing models,” said Michael L. Mathaisel, an intellectual property attorney at McCarter & English in Boston.

Mathaisel, a former Disney software engineer, added that “Open-source developers make the code freely available to others on what is essentially a type of honor system. General disregard for open-source licenses would lead to the eventual breakdown of the open-source movement, which, in my opinion, would be a real shame.”

Another best practice is to be aware of the rules of app stores regarding open-source licenses. “Some of these app stores have restrictions on what kind of licenses they accept,” said Cope. “And some open-source licenses have restrictions regarding third-party distribution as well.”

Many mobile app developers may not have a complete picture of the open source software they are using but try to submit their mobile apps to the app stores anyway. This can have real-world implications. App stores will often reject apps that don’t meet their compliance specifications.

“Generally speaking, you have to be really careful about what development tools go into applications that are submitted to app stores,” explained J. Gerry Purdy, a mobile and wireless expert and principal analyst at MobileTrax. “Apple, particularly, does a scan of the source code and looks at the utilities and, if it thinks any of them may be open source that violates some kind of license, it will not approve the app until the software’s changed.”

You can also get in deep trouble a lot more quickly when you distribute your mobile apps via app stores and other third-party distributors. “Mobile apps are invariably distributed by volume. Apps are downloaded by the millions, sometimes in a matter of days,” said Koohgoli. “So if your mobile app has any quality issues or licensing violations, these deficiencies will be discovered extremely quickly.”

Use open-source development tools and frameworks
There are open-source development frameworks available that can help you rapidly build native apps for all the major smartphone operating systems, including Android, iPhone, RIM, Windows Mobile and Windows Phone 7. You can then submit your finished mobile app to the app stores with confidence.

“Two companies, Appcelerator and Rhomobile, focus on generating applications that are then submitted to these app stores,” Purdy said. “They know all the nooks and crannies about how to build—and not build—apps that will comply with the app store environments.”

Added Gruber, “PhoneGap is another example of an open-source framework that helps you do this.” Adobe’s PhoneGap is an HTML5 app platform that lets developers write native apps with Web technologies and get access to APIs and app stores.

“My advice is to make sure your apps support multiple platforms,” said Koohgoli. “As a developer, you want to do this to make sure your app has the widest market appeal.”

To ensure that your app does support many platforms, use the software that’s readily available from vendors. Their software lets you write your source code in one programming language and then use the software to translate it into different languages. Ultimately, your finished mobile app will work on multiple mobile platforms.
#!
Use automated code-scanning and auditing tools
Automated code scanning and auditing tools can help you see how much open-source code you use, where specific open-source packages are used, and what needs to be done to ensure compliance with open-source licenses.

“To make sure none of your open-source code violates open-source licenses, use automated scanning and auditing tools,” said Gruber. “This can help tremendously in meeting licensing requirements, and also helps others in your organization to see what code you have used.”

Many app developers are already using these tools. In fact, open-source code scans are way up in 2012, according to a statement by OpenLogic. The company has seen a 730% increase in open-source code scans run in Q1 2012 over Q1 2011.

“It’s important to do a scan or audit of your source code,” said Cope. “Scanning tools are becoming more and more popular as they can really help you find bugs and fix them. You can then report your findings back to the open-source community.”

Developers are scrambling to build mobile apps for the most common platforms. In 2011, OpenLogic found that 88% of Android apps contained open source and 41% of iOS apps contain open source.

open-source mobile apps

According to Forrester Research analyst Jeffrey Hammond, these are the two platforms that are still way ahead in terms of popularity. “Right now, the third-party developers who choose OSS licenses are favoring Android and iOS above all others, and favoring Android by a wide margin,” Hammond wrote in his May 16, 2012 blog post, “Open source: an emerging driver for mobile first strategy.”

BZ Research (the research arm of BZ Media, which publishes SD Times) recently conducted a mobile developer survey that also showed that the two most popular platforms are still, by far, Android and iPhone. According to the survey, the platforms that developers are currently building mobile apps for (in order of popularity) are Android Phone, iPhone, iPad and Android Tablet. The next most popular platforms, the survey said, are for Windows Phone, BlackBerry OS, Kindle Fire, Symbian, Tizen/MeeGo, and Brew.

“By some estimates, intellectual property accounts for 45% of the U.S. GDP,” said Mathaisel. “We have shifted from a manufacturing economy to one in which our most important output is intellectual property. In view of this, it is prudent to respect the intellectual property rights of others, as the risks and costs associated with not doing so are ever-increasing.”

Suzanne Kattau is a freelance IT writer based in Huntington, N.Y.