Building native mobile apps for DX
This document presents one of the two main possibilities of how to address the mobile rendering needs for your CMS/WCM projects using Digital Experience Manager. Our product has two technologies that can help in this regard:
- Channel-based rendering and editing
- REST API to build native clients
This guide covers the second technology. If you’re interested in the first, building mobile web sites using Digital Experience Manager, please read our companion document: Mobile web developer guide.
2 Target audience & assumptions
It this document it is assumed that the reader has a working knowledge of the following:
- Java programming
- JSP programming
- Jahia template development
- Mobile development
If you are not familiar with one of the above-mentioned fields, we recommend you get at least familiar with them. For Digital Experience Manager template development, please check our documentation on http://www.jahia.com.
The first chapters will be more focus on presenting some of the concepts behind mobile application development using the Digital Experience Manager platform, but the next ones will go into technical details as how to implement such solutions. A working knowledge of Digital Experience Manager development and integration is therefore strongly recommended.
3 Native mobile applications
An alternative to building web sites that target mobile devices is developing a native mobile application. This is usually a tradeoff since building a mobile application means that it will be proprietary to the device’s operating system. So the development of a native mobile application will not be reusable when targeting another device. But building a native application usually makes for a better user experience, as the interactions will be smoother and less dependent on network availability.
A native application must use some kind of protocol to communicate with a server, and in the case of integrating with Digital Experience Manager, it is of course possible to request HTML renderings to display directly on the mobile screen using a web view. But if the data needs to be re-formatted or presented in different views in the native app, or if network traffic must be reduced to an absolute minimum, it is best to use Digital Experience Manager’s REST API.
Digital Experience Manager REST API makes it possible to retrieve, create, edit and delete content simply by using basic HTTP requests that retrieve JSON content and use HTTP POST to perform content actions. This seemingly simple protocol is actually very powerful and most content actions you perform through Digital Experience Manager’s UI are also available through the REST API. And as it is possible to develop custom actions, any missing functionality may be implemented by developing custom actions packaged in custom modules.
An interesting example application illustrating the usefulness of the REST API is a prototype of a native iPhone/iPad application that was designed by Digital Experience Manager. As this is a prototype that is not available publicly, if you are interested in learning more about it, please contact us at firstname.lastname@example.org. The native application connects to Digital Experience Manager on startup, retrieves a configuration file that contains different screen properties, notably queries that will be executed with the REST find servlet. The results are generated using JSON output. The native application can then display the content anyway it chooses. Having the content in JSON format makes it easy to adapt to multiple screen sizes, as the native prototype is a dual iPhone and iPad application. The application is also capable of creating new content by using POST HTTP requests to create new content objects. All this is quite optimal and integrated with Digital Experience Manager‘s authentication as it also uses the login and logout servlets.
As you can see in the above example, the native application displays the ACME demo content with native device rendering. This makes for a strong mobile user experience while having exactly the same content base as the regular web site. It is also possible to cache the data on the native client for offline browsing. The prototype demo application is also a native iPad application, as may be seen in the screenshot below:
The iPad version displays a little differently, making good usage of the extra screen space, while retaining access to the same content objects as the iPhone and the public web site.
It also features an example of native data input, including text input as well as upload of binaries such as pictures. In the example below the user is selecting a picture from the picture gallery after entering a title and an article body:
In this native prototype we have only scratched the surface of what is possible with REST API. Please refer to Digital Experience Manager’s documentation available on http://www.jahia.com/documentation-and-downloads/developers-techwiki to learn more about this and other technologies that will help you achieve your multi-channel objectives.
3.1 Native multi-platform frameworks
The main problem when building native a mobile application is that each device has it’s own proprietary SDK, and these are often not compatible. For example the iOS SDK requires programming in the Objective C language, while the Android and Blackberry SDKs use Java as the main programming language. The provided libraries used in each SDK are quite different and incompatible, so it makes porting code from one platform to another very difficult, and often implies building or purchasing custom compatibility layers to obtain abstractions that help code portability. There is some common ground on the 3D side though, because often OpenGL is used as an underlying 3D framework, but this technology is also very low level and requires a lot of effort to build basic 3D applications.
Because of these porting difficulties, multi-platform frameworks have emerged to help code re-use across platforms, and we will now illustrate these with a few examples that might prove interesting to integrate in native mobile projects.
3.1.1 Adobe PhoneGap / Apache Cordova
Also, it is possible to combine PhoneGap with jQuery Mobile, making it very easy to build native mobile applications that look and feel great using a lot less development effort. If you’re interested in learning more, we have a webinar recording available on our website.
Pugpig is another alternative to building mobile cross-platform solutions, aimed more precisely at the publishing industry. Using Pugpig you can use HTML 5 to easily build magazines or other digital packages to publish content on the go. Digital Experience Manager is capable of integrating with Pugpig by generating and packaging digital bundles that can then be compiled into a native application. At the same time, it is also possible to use Digital Experience Manager’s REST API to access content dynamically from a digital bundle distributed in a Pugpig native mobile application. Again, we have a webinar recording available if you are interested in learning more about this type of framework integration.
4 Additional resources
We present in this section some references we have presented in this document as well as additional reading material that may be interesting to learn more about mobile technologies.
- Digital Experience Manager’s Mobile web developer guide, http://www.jahia.com
- Wireless Universal Resource File, WURFL, http://wurfl.sourceforge.net/
- Apache Mobile Filter, http://www.apachemobilefilter.org
- Apple iOS developer center, http://developer.apple.com/ios
- Google Android developer center, http://developer.android.com/index.html
- Blackberry developer center, https://developer.blackberry.com
- CSS media queries, http://www.w3.org/TR/css3-mediaqueries/
- Adobe Phone Gap, http://phonegap.com
- Apache Cordova, http://incubator.apache.org/cordova/
- Pugpig, http://pugpig.com
- Titanium, http://www.appcelerator.com
- jQuery Mobile, http://jquerymobile.com
- Bootstrap, http://twitter.github.com/bootstrap/