Testing Cordova Apps on Your BlackBerry 10 Phone

Apache Cordova, better known as PhoneGap, Adobe’s commercialized edition of Cordova, allows developers to create apps for a variety of platforms using a single HTML5, CSS and JavaScript code base. This approach of cross-platform development works for all established mobile platforms and doesn’t stop at exotic ones, such as BlackBerry 10.

Despite its infinitesimal market share, there are valid reasons to target the BlackBerry 10 platform. Adding BlackBerry 10 as a target platform to a Cordova-based project is as easy as running the cordova platform add blackberry10 command on your terminal. However, if you try to deploy your app to the device and run cordova run blackberry10, you might stumble upon the following error message:

blackberry-nativepackager cannot be found on the path. Aborting.

It seems as if we are missing the native platform SDK here. In this article, I want to show you which steps are required in order to successfully run and debug your Cordova-based app on your BlackBerry 10 phone. Please note that I’m using OS X, so the exact steps may and will differ on other platforms.

Note: macOS 10.12 Sierra does not support the BlackBerry Link drivers required to connect to your device.

Continue reading Testing Cordova Apps on Your BlackBerry 10 Phone

The Mysterious 17 Pixels Shift

One of the most curious bugs I ever came across was found deep inside a third-party JavaScript grid component. This grid component had a fixed height and width. It calculated column widths by taking the total grid width and distributing it to the different columns, each of which got a certain, predefined percentage.

On Mac OS X, everything looked nice. But on Windows, the column headers were oddly shifted and did not match the content columns. While investigating the bug, we found out that the columns were shifted by exactly 17 pixels to the left. But why 17 pixels? And not 5, 10, 15 or anything power of 2?

Continue reading The Mysterious 17 Pixels Shift

Speeding up Your Mono Server Application, but Watch the Argument Order

Mono has a –server option that can radically improve the response behavior of .NET server applications when run on Mono. From mono’s man page:

–server: Configures the virtual machine to be better suited for server operations (currently,  allows a heavier threadpool initialization).

However, when I tried using the server option for the first time, I was very disappointed that it didn’t work. After some time I found out that I caused the problem myself. Why? Because

mono MyApp.exe --server

is unfortunately not the same as

mono --server MyApp.exe

The latter is correct and works like a charm (on Mono 3.2.3 and higher).

Mono’s options must be placed before the file name, because otherwise the option is treated as an argument passed to the given .NET application. This is a simple, yet mean mistake, because you are used to append any parameters at the end of a command.

Conclusion: Sometimes it can be helpful to also look at the top of the man page, where it clearly states that the actual argument order is like the following:

mono [options] file [arguments...]

Looking Back: AngularJS, Cordova and the Windows Phone Back Button

Recently we brought a Cordova-based web app which already runs successfully on iOS and Android to Windows Phone 8.1. One of the issues you will definitely come across when porting your app to this platform is the handling of the back button, an essential part of Windows Phone’s user experience.

By default, pressing the back button on Windows Phone closes your Cordova-based app, regardless of the current state. Instead, the back button should bring you back to the previous view; except on the main page, where pressing it must suspend the current app (according to the Windows Store Policies, 10.4.4):

Where applicable, pressing the back button should take the user to a previous page/dialog. If the user presses the back button on the first page of the app, then the app terminates (unless it is allowed to run in the background).

Not respecting those policies may not only lead to a rejection of your app, but also to bad ratings in the Store.

Continue reading Looking Back: AngularJS, Cordova and the Windows Phone Back Button

Enabling Cross-Platform Touch Interactions: Pointer vs. Touch Events

Detail of Michelangelo’s Creation of Adam

Your customers love mobile devices and apps. And they love the way of interacting with them, using touch.

Touch is a very natural input method and multi-touch allows intuitive gestures such as pinch-to-zoom. As mobile or web developers, we also love apps and touch interaction. But, face it, we are also quite lazy. We want to run code written once to execute on several browsers and platforms resulting in one and the same behavior. Unfortunately, there are two competing methods that allow interacting with websites using touch input:

Continue reading Enabling Cross-Platform Touch Interactions: Pointer vs. Touch Events