Oct 1, 2015

5 Cordova project configurations for iOS and Android

Apache Cordova command line tool(CLI) provides a unified way to manage and build mobile applications across platforms. Unfortunately, it is not always possible to provide configuration options generic enough that span all supported platforms. For those cases, Cordova takes a platform specific approach.

Here is a small guide for 5 of these less known configuration options. All of these options are managed on the config.xml file on your project. As attributes of the root widget node.

  1. android-packageName

    Normally, the the package name for an Android application is generated from the id of the Cordova application. Presence of android-packageName on the config.xml causes the package name on AndroidManifest.xml and java package name for the activity class to be generated from its value.

  2. android-activityName

    The android-activityName attribute allows the main activity name to be specified. Activity name is one of those things that cannot change in Android. Therefore this feature becomes useful when renewing an older implementation with a Cordova based one or upgrading between Cordova versions that have different default activity name values.

  3. android-versionCode

    Sets the versionCode value on the application’s manifest file. If android-versionCode is not specified versionCode is generated to have the default value of 1. If you are wondering why the default value is 1 instead of the value of the version attribute, this is because versionCode is restricted to be an integer.

  4. ios-CFBundleIdentifier

    ios-CFBundleIdentifier determines the value of CFBundleIdentifier key in the Info.plist file of your application. This key is the unique identifier for your application on the system. If ios-CFBundleIdentifier is not specified the value of the id field will be used when generating Info.plist.

  5. ios-CFBundleVersion

    This is the iOS cousin of the android-versionCode explained earlier. They pretty much serve similar purpose on their respective platforms. You should be aware of the quirks when defining the value. If ios-CFBundleVersion is not specified the value of the version attribute is used for generating the iOS application.

Here is a complete example that specifies all the values:

  <widget id="application.id" version="0.0.1"
    xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"

Read more →

Jul 29, 2015

Try Red Hat's Mobile Application Platform on Openshift

You can now try the Red Hat Mobile Application Platform (RHMAP) yourself. This is the platform that Red Hat acquired last year and now there is a version of it running on Openshift online. If you have an Openshift online account, browse to openshift.feedhenry.com and request your invite. Both Openshift online and RHMAP invite are free.

As a bonus, here is a video that shows how to use JBoss Developer Studio 9 and RHMAP together to build Apache Cordova based applications.

Read more →

Mar 20, 2015

What is new on Eclipse Thym 0.2.0

We have just released a new version of Eclipse Thym.

Compared to 0.1.0 release the highlights for the 0.2.0 release are.
  • Working sets are supported on New Hybrid Mobile Project wizard: You can add your Hybrid Mobile projects to JavaScript working sets during project creation.
  • Convert existing Eclipse projects to a Hybrid Mobile project: Any existing Eclipse project, that has a proper config.xml and www directory, can be converted using the Configure > Convert to Hybrid Mobile Project menu item. This feature also introduces a new API to enable adopters to programmatically convert existing projects to Hybrid Mobile projects.
  • Icon and Splash Screen support for iOS and Android builds:  If your config.xml has icon and/or splash screen references. Native project or executable exports created from Thym will honour them. Refer to Apache Cordova documentation for details of icon and splash screen support. 
As usual Thym 0.2.0 is available from these update sites and Eclipse marketplace.
  • Update existing installs:
    • http://download.eclipse.org/thym/releases/latest/
  • Release repository good for building against:
    • http://download.eclipse.org/thym/releases/0.2.0/
Read more →

Jan 2, 2015

GPIO with Node.js in Pidora

So you have node.js running on a raspberry pi (if not see earlier post), I guess next you want to do some physical computing, and get some LEDs blinking.

In order to do physical computing, you need a library to access GPIO. Luckily, there is no shortage of   libraries for GPIO on npm. Without spending too much time, I have tried a few of them and for no particular reason, I have chosen to use wiring-pi.  wiring-pi is actually bindings to the WiringPi , a well known C library for GPIO.

Pidora actually includes WiringPi so you can actually start using it right away. It does come with a command line utility called gpio. However, the wiring-pi npm package does check out and compile its own copy of the library so if you do not already have it installed on your raspberry pi, do not worry.

Because wiring-pi needs git to retrieve WiringPi,  you need git to be available on your raspberry pi. First install it using

yum install git

Now you are ready to install wiring-pi

npm install wiring-pi

If you have followed my earlier post for installing node.js, you probably have a second node installation that came with pidora. In some cases, gyp conflicts with this obsolete one and installation of the wiring-pi may fail. To fix remove gyp and try to install wiring-pi again.

yum remove gyp
npm install wiring-pi

Since blinking LEDs were mentioned, here is a sample code that I have used, which is the example code from wiring-pi Github repository with a small change.

Read more →