Tag Archives: Windows Phone

Unified Multi-Platform Push Notifications with IBM MobileFirst

Push notifications, love them or hate them, are everywhere and there’s no getting around it. Push notifications are short messages that can be sent to mobile devices regardless of whether the apps are actually running. They can be used to send reminders, drive engagement with the mobile app, notify completion of long running processes, and more. Push notifications send information to you in real time, rather than you having to request that information.

Regardless of the platform or native/hybrid development approach, push notifications have to leverage the messaging infrastructure of the platform. iOS apps that have push notifications must use APNS (Apple Push Notification Service), Android apps must use GCM (Google Cloud Messaging), Windows Phone apps use MPNS (Microsoft Push Nofitication Service), and others use SMS gateways.

If you are building a back-end infrastructure to manage your application’s data, and you want to leverage push notifications, then guess what? You also have to build the hooks to manage subscription and distribution of push notifications for each platform.

If you’re building your app with IBM MobileFirst, guess what? You already have a unified API to communicate with all of these platform push notification services with a single API. Yes, you read that correctly – in addition to operational analytics, remote logging, simple data adaptersmobile application sharing, app management, encrypted offline storage, SSO, and support for both native and hybrid paradigms, IBM MobileFirst also has a single, unified multi-platform push notification API that simplifies your development effort for subscribing and managing push notifications on numerous platforms. Check out the video below for additional detail.

The unified push notification API allows you to develop your app against a single API, yet deliver push notifications to multiple platforms, and it works with both hybrid (HTML/CSS/JS) apps, as well as native apps.

MobileFirst Push Notification Mechanism
MobileFirst Push Notification Mechanism


The IBM MobileFirst push architecture supports numerous scenarios, including user targeted or broadcast messages.

You will still have to build the logic to subscribe devices for messaging, and dispatch push notification messages, but you’ll only have to do it once against the unified API – not once for each platform.

The apps that I showed in the video above are sample apps taken straight from the IBM MobileFirst platform developer guide for iOS and Android, and can be accessed in their entirety (with both client and server code) using the links below:

The client-side code will vary slightly depending on the native platform or hybrid approach, but the server-side implementation will be exactly the same.

When configuring your server for sending push notifications, be sure to follow the platform-specific steps to provision the apps/server for sending and receiving push notifications.

Within an adapter service on the MobileFirst server, you need to define an event source for push notifications.

name: ‘PushEventSource’,
onDeviceSubscribe: ‘deviceSubscribeFunc’,
onDeviceUnsubscribe: ‘deviceUnsubscribeFunc’,

On the client app, you’ll need to subscribe for messages from the event source. See the hybrid or native code linked to above for syntax and examples.

Once your clients are subscribed, you can use a single server-side implementation to distribute messages to client apps. Below is an excerpt from the sample application which demonstrates sending a push notification to all devices for a particular user (on any platform):

[js]function submitNotification(userId, notificationText){
var userSubscription =
WL.Server.getUserNotificationSubscription(‘PushAdapter.PushEventSource’, userId);

if (userSubscription==null){
return { result: "No subscription found for user :: " + userId };

var badgeDigit = 1;

var notification =
WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"});

WL.Logger.debug("submitNotification >> userId :: " + userId + ", text :: " + notificationText);

WL.Server.notifyAllDevices(userSubscription, notification);

return {
result: "Notification sent to user :: " + userId

From the MobileFirst console, you will be able to monitor and manage event sources, platforms, and the devices that are consuming push notifications.

Push Notifications on the MobileFirst Console
Push Notifications on the MobileFirst Console


If you were wondering, yes, these can be cloud-hosted on IBM BlueMix and yes, it can also be installed on-premise on your own server in your data center.  You have the option to configure your physical or cloud servers however you want.

Not sure where to go next? Maybe these will help:

So, What is IBM MobileFirst?

I’m still “the new guy” on the MobileFirst team here at IBM, and right away I’ve been asked by peers outside of IBM: “So, what exactly is MobileFirst/Worklight?  Is it just for hybrid apps?”

In this post I’ll try to shed some light on IBM MobileFirst, and for starters, it is a lot more than just hybrid apps.


IBM MobileFirst Platform is a suite of products that enable you to efficiently build and deliver mobile applications for your enterprise, and is composed of three parts:

IBM MobileFirst Platform Foundation

IBM MobileFirst Platform Foundation (formerly known as Worklight Foundation) is a platform for building mobile applications for the enterprise.  It is a suite of tools and services available either on-premise or in the cloud, which enable you to rapidly build, administer, and monitor secure applications.

The MobileFirst Platform Foundation consists of:

  1. MobileFirst Server – the middleware tier that provides a gateway between back-end systems and services and the mobile client applications.  The server enables application authentication, data endpoints/services, data optimization and transformation, push notification management (streamlined API for all platforms), consolidated logging, and app/services analytics. For development purposes, the MobileFirst server is available as either part of the MobileFirst Studio (discussed below), or as command line tools.

  2. MobileFirst API – both client and server-side APIs for developing and managing your enterprise mobile applications.
    • The server-side API enables you to expose data adapters to your mobile applications – these adapters could be consuming data from SQL databases, REST or SOAP Services, or JMS data sources. The Server side API also provides a built-in security framework, unified push notifications (across multiple platforms), and data translation/transformation services. You can leverage the server-side API in JavaScript, or dig deeper and use the Java implementation.
    • The client-side API is available for native iOS (Objective-C), native Android (Java), J2ME, C# native Windows Phone (C#), and JavaScript for cross-platform hybrid OR mobile-web applications. For the native implementations, this includes user authentication, encrypted storage, push notifications, logging, geo-notifications, data access, and more.  For hybrid applications, it includes everything from the native API, plus cross-platform native UI components and platform specific application skinning.  With the hybrid development approach, you can even push updates to your applications that are live, out on devices, without having to push an update through an app store.  Does the hybrid approach leverage Apache Cordova?  YES.

  3. MobileFirst Studio – an optional all-inclusive development environment for developing enterprise apps on the MobileFirst platform.  This is based on the Eclipse platform, and includes an integrated server, development environment, facilities to create and test all data adapters/services, a browser-based hybrid app simulator, and the ability to generate platform-specific applications for deployment.  However, using the studio is not required! Try to convince a native iOS (Xcode) developer that they have to use Eclipse, and tell me how that goes for you… 🙂  If you don’t want to use the all-inclusive studio, no problem.  You can use the command line tools (CLI).  The CLI provides a command line interface for managing the MobileFirst server, creating data adapters, creating the encrypted JSON store, and more.

  4. MobileFirst Console – the console provides a dashboard and management portal for everything happening within your MobileFirst applications.  You can view which APIs and adapters have been deployed, set app notifications, manage or disable your apps, report on connected devices and platforms, monitor push notifications, view analytics information for all services and adapters exposed through the MobileFirst server, and manage remote collection of client app logs.  All together, an extremely powerful set of features for monitoring and managing your applications.

  5. MobileFirst Application Center – a tool to make sharing mobile apps easier within an organization.  Basically, it’s an app store for your enterprise.

MobileFirst Platform Application Scanning

MobileFirst Platform Application Scanning is set of tools that can scan your JavaScript, HTML, Objective-C, or Java code for security vulnerabilities and coding best practices.  Think of it as a security layer in your software development lifecycle.

MobileFirst Quality Assurance

MobileFirst Quality Assurance is a set of tools and features to help provide quality assurance to your mobile applications.  It includes automated crash analytics, user feedback and sentiment analysis, in-app bug reporting, over-the-air build distribution to testers, test/bug prioritization, and more.

So, is MobileFirst/Worklight just for hybrid (HTML/JS) apps? You tell me… if you need clarification more information, please re-read this post and follow all the links.  😉


PhoneGap on Windows Phone via OSX

I am embarking on a new PhoneGap project that will have to run on many platforms… iOS, Android, BlackBerry, and Windows Phone.  This will actually be my first foray into modern Window Phone development. (I did some experimental work with the Windows Mobile platform many years ago, but a lot has changed since then.)

One of the caveats with Windows Phone development is that it has to be done from Windows, just like iOS development has to be done from OS X (normally, although some cross platform technologies enable development via other OS/platforms).

Of course, I did not want to give up OS X, so here’s how I have my environment setup…  I have a virtual machine running Windows 7, in which I can run the Visual Studio development tools.   I am able to deploy to a physical Windows Phone device using the USB connection.

Windows Phone Development with PhoneGap, on OS X

However, with this configuration you will NOT be able to use the Window Phone emulator, which is a part of the Windows Phone development SDK.   The Windows Phone emulator is not supported inside of a VMWare virtual machine because the emulated operating system environment does not meet the minimum requirements (specifically the graphics drivers are not WDDM 1.1 compliant).   If you try to use the phone emulator inside the virtual machine, you will just get a blank screen.   I spent a few hours trying to find a workaround, to no avail.   You can use the Windows Phone emulator if you boot your Mac into Windows using Bootcamp, but I wanted to keep OS X as my primary operating system.

Being able to deploy directly to a device works for me, and is (in my opinion) better than being able to deploy to an emulator, thus I am happy with this workflow.   I have heard that other people have had trouble deploying to Windows Phone devices through a VMWare emulator, so here are the details on how I have my environment setup and a few “getting started” links for PhoneGap development on Windows Phone:

Note: All of the project setup work will be done through the Windows virtual machine instance.

There is a detailed “Getting Started” guide for PhoneGap and Windows Phone available at http://phonegap.com/start#wp.  This will provide you with all the information that you need to get started with PhoneGap applications for Windows Phone.

As a part of the setup process, you will need to download and install the Windows Phone SDK from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27570.   This will include a copy of Visual Studio Express 2010 for Windows Phone, as well as additional tools for Windows Phone development.

To be able to deploy an application to a physical Windows Phone device, you will need to register as a Windows Phone developer on MSDN App Hub at http://create.msdn.com/en-US/home/membership.   This is a very similar model to Apple’s iOS developer program.  There is a $99 annual fee, and once you are registered, you will be able to debug on devices and distribute applications via the Windows Phone Marketplace.   However, debug provisioning is much easier.   Instead of signing each application with a debug certificate, you just have to register your device as a development device.   Once the device is registered, you will be able to deploy to it without any other special steps; this is very similar to the provisioning model for Nook devices.

When linking my AppHub account to my Windows Live account (a required step), I ran into a vague error message “There’s a temporary problem with the service.  Please try again.  If you continue to get this error message, try again later.”   After scouring the web for this error message, I found a few threads that mentioned this error is likely the result of an incomplete profile for your Windows Live account. Sure enough, I went into live.com and filled out my profile (including contact information), and this error went away.

My Setup

Below are the specifics for my setup; I did not have any issues connecting a Windows Phone device with this configuration.

Device Registration

To deploy an application to a Windows Phone device, you just have to use the Windows Phone Developer Registration Tool, and walk through a few simple steps to associate your phone with your developer account.  This tool is installed when you install the Windows Phone SDK.   You can read full details about debugging Windows Phone applications on MSDN.

As I mentioned above, I have heard that others have encountered problems when trying to deploy applications to Windows Phone devices via a virtual machine on OSX, but I have not had any problems with this configuration.