Native mobile apps

Last updated on
22 September 2016

Native Mobile Application Development

Drupal isn't just a web-based content management system - you can use Drupal as the backend for mobile application development. Drupal can contain your content, business logic, user management, and search functionality, and your app can be a front end that talks to Drupal using the Services module.

Native Mobile Application Capabilities

Building a native mobile application gives you two different things that mobile web applications don't have - distribution through mobile app stores and access to native functionality. Some things you can get with a native mobile application are:

  • Charge for app in Google Play or App Store
  • In app purchase and subscriptions through the App Store, Google Play, or other app stores
  • In app advertising from native mobile app networks
  • Access to the device's camera for images or video
  • Access to the device's file system for caching
  • Access to the device's contacts
  • Native map functionality
  • Device's accelerometer, gyroscope, compass, and map
  • Background location awareness (on iOS 5)
  • Image filters (such as sepia, halftone, etc.) (on iOS 5)

Many of these things will be available to mobile web applications in the future, but native mobile applications are the only way to get many of these things right now.

Mobile Application Strategy

Before starting your mobile application development project, it helps to determine which platforms you want to target, and whether you want to use platform-specific capabilities within your app. For instance, with iOS, you can have a mobile application that gets activated when your users cross a location boundary. Or on Android, your mobile application can be integrated with other Android applications using the Android Intent framework. Sometimes, you can access this functionality through cross-platform native mobile application development tools, but then you lose many of the advantages of cross-platform development.

You should also consider what technical skills your team has before choosing a solution. Android applications are typically written in Java, and iOS applications are written in Objective-C. These languages are significantly different from a typical Drupal developer skillset of PHP/SQL/HTML/CSS/JS - to reuse existing language skills, consider using either Titanium or PhoneGap to develop your mobile applications.

Developing Native Apps for iPhone/iPad/iPhone Touch

Apple's devices run the iOS operating system, and native apps running on iOS are generally written in Objective-C or Swift. You will need a Mac for iOS development that is capable of running Apple's XCode IDE. Connecting to a Drupal site running the Services module is very straightforward, especially with one of two HTTP libraries:

Waterwheel Swift provides a layer of abstraction on top of AlamoFire for working with Drupal nodes, files, users, and views. 

Things to consider when developing a native RESTful iOS app are caching strategies, using asynchronous methods to download data and then refreshing data as downloads complete, pre-fetching data on application load, and managing network timeout issues.

For more information about developing native mobile apps for the iPhone or iPad:

Links for these projects

Other Examples/Projects

DrupalRESTKit :

Tips&Tricks AFNetworking :

Tips&Tricks NSURLSessionAPI :

Demo :

Developing Native Apps for Android

Appcelerator Titanium is a mobile application development tool that uses Javascript as the development language. Titanium produces both iOS and Android applications from one code base.

Developing Native Apps with PhoneGap

PhoneGap is a native application wrapper for mobile web content that also provides access to device-level services. PhoneGap supports the iOS, Android, Windows Phone, and BlackBerry mobile application operating systems, and can run on both smartphones and tablet devices.

Several projects for integrating Drupal with PhoneGap exist:

  • Drupal Plugin for PhoneGap for iOS, which makes the Drupal iOS SDK accessible through PhoneGap.
  • PhoneGap module which provides both an Android application and a Drupal 7 module for creating/browsing nodes from PhoneGap
  • DrupalGap - An open source mobile application development kit for Drupal websites, with PhoneGap and jQueryMobile.

Additional Resources

Several different ways of integrating Views into mobile applications exist - depending on what you are trying to accomplish, you may want to consider one of these modules

  • Web services
  • Using Drupal Views
    • Services Views - provides a Views resource for the Services module
    • Views Datasource - provides representations in JSON, XML, RDF, xHTML microformats, Atom, and several other formats
    • Views Atom - Creates an Atom-formatted View for the "Feed" display type