Introduction to PhoneGap

Your end users expect mobile access to enterprise resources now. Unfortunately, our traditional remote access methods do not lend themselves easily to mobile form factors. So, we are left with the choice to use 3rd party apps, “mobilize” existing apps, or build our own. This article will address one of the players aimed at helping you build your own mobile apps with less effort.

Mobile Enterprise Apps – Virtualize, Buy, or Build?

When it comes to mobile enterprise applications, you basically have 3 choices:

  1. Virtualize what you have (via Citrix HDX, RDP, VMware PCoIP, etc.)
  2. Buy something from a 3rd party
  3. Build something yourself

There are use cases for each of these, but I’m going to focus on one way to build something yourself.  In this case, I’m going to cover PhoneGap.

 

What is PhoneGap?

PhoneGap is a framework for building mobile applications using only HTML, CSS, and Javascript.  This removes the complexity of using multiple programming languages for the various mobile platforms out there.  The PhoneGap framework gives developers access to almost all of the device’s features such as GPS, Camera, Accelerometer, Notifications, etc. via the included Javascript library.

The easiest way I think of it is like this – PhoneGap is a specialized web browser without a user interface.  There is a specialized web browser for each native platform – iOS, Android, Windows Phone, Blackberrry, etc.  This allows you to reuse your code across platforms; however, this does not allow you to use one IDE for all platforms.  Each PhoneGap app you build gets complied into this chrome-less browser and delivered just like any other native application.  The end result is an individual .ipa (for iOS), .apk (for Android), .xap (for Windows Phone), etc..  Therefore, you still have the ability to use all your EMM and MAM tools you may already have to manage these apps. Each time you build a new PhoneGap app, you get a new .ipa, .apk, .xap, etc. that includes the chrome-less browser and your HTML, CSS, JavaScript, etc.

PhoneGap

What’s needed to develop with PhoneGap?

You still need to use the various platform IDE’s to develop an app with PhoneGap.  For instance, I developed a simple app for iPhone and Android.  For iPhone, I used Xcode to create and compile the PhoneGap application.  For Android, I used Eclipse to create and compile the application.  I had to set up each IDE to use the PhoneGap framework, but that is all documented pretty well.

I started with Xcode and got things working liked I wanted for iPhone.  Then, I literally just copied and pasted my HTML, CSS, and images over to Eclipse and the Android app just worked.  My app is very simple, but here are the results:

What is the catch?

PhoneGap is free.  Even though Adobe acquired PhoneGap in 2011, the PhoneGap code was contributed to the Apache Software Foundation (ASF) under the name Apache Cordova and graduated to top-level project status in October 2012.

I have noticed that some PhoneGap apps seem to run a little sluggish when dealing with animations as compared to traditional apps.  I’m assuming this is due to the chrome-less browser nature of PhoneGap applications.  However, when dealing with enterprise applications, I do not see this as being a big issue.

The other issue I see for enterprises (and this is not unique to PhoneGap) is data access.  Your application is really just another front end for data.  You have to provide enterprise data access somehow.  This can be done via VPN, or using local device storage and sync strategies.  Like I said, this isn’t unique to PhoneGap, but it is something to think about.

Conclusion

PhoneGap lowers the bar of entry into “native” device applications because there are a lot of HTML, CSS, JavaScript developers out there.  Oftentimes, enterprises may already employ people with expertise in these areas.  If not, it is more budget-friendly to hire a Web developer as opposed to developers that specialize in Objective-C and/or Java and/or .Net languages.  You get the benefits of maintaining one code base across multiple devices.  All of your EMM/MAM products should work with PhoneGap applications.

On the contrast, you are not developing “real native” code and devices may come out with features faster than the PhoneGap framework can accommodate.  You still have a data problem.  If your app requires a lot of fancy animated graphics, then PhoneGap may or may not suit your needs.

So, there you go.  If you have experience with PhoneGap or just something to add, feel free to leave a comment below.

 

Installing and Using the Citrix XenApp 6.5 Mobile Application SDK

In this post, we will go over the installation steps of the Citrix XenApp 6.5 Mobile Application SDK, explorer what is added to the XenApp 6.5 server during installation, and compile one of the samples given in the SDK.

Now that we have setting up an Android emulator out of the way, let’s take a look at installing the Citrix XenApp 6.5 Mobile Application SDK and what the install does to a XenApp 6.5 server.

There are 2 parts that you need in order to develop applications that utilize mobile capabilities on a XenApp 6.5 server:

  1. The XenApp 6.5 Mobility Pack – this is the part that goes on the XenApp 6.5 server.
  2. The Citrix XenApp 6.5 Mobile Application SDK – this is the part you use to develop mobile applications.

 

XenApp 6.5 Mobility Pack

When you install the Mobility Pack, 2 new services are added to your XenApp server:

  1. Citrix Location and Sensor Virtual Channel Service – this service enables a server side application to leverage Location and Sensor capabilities.
  2. Citrix Mobile Receiver Virtual Channel Service – this service enables a server side application to use mobile device capabilities.

These 2 virtual channels are kept separate for security reasons.  Maybe you want to have mobile device capabilities available, but you cannot enable GPS features due to security compliance.  Location services are disabled on the Citrix Receiver by default. The way to enable the location capabilities is via Citrix policies.  In order to use these policies, you will need to install the Citrix Group Policy Client-Side Extensions.  These extensions are part of the XenApp Mobility Pack .zip file.

This policy is located under ICA\Client Sensors\Location. Notice that by default, location is disabled.

 

Citrix XenApp 6.5 Mobile Application SDK

So, the requirements for the Citrix XenApp 6.5 Mobile Application SDK state that you need Windows 7 64 bit (and the MSI is even named XenApp65MobileApplicationSdk64), but it installs to ..\Program Files (x86)\Citrix\MobilitySDK\.  I tried installing the SDK on a Windows 7 32 bit system as well and it worked, so I’m not sure if something absolutely will not work on 32 bit.

I’m using Visual Studio for the examples.  It appears that Visual Studio Express (free) will work as well, but I haven’t tested that myself.

Anyway, the documentation that comes with the SDK is pretty comprehensive so I’m not going to rehash it here.  Since I will be showing you some of the examples using .Net, I do want to point out that you will need to run one of the following commands on your development machine in order for things to work:

Regsvr32 cmpcom.dll
Regsvr32 cmpcom64.dll

Notice that there is a 32 bit or a 64 bit DLL register. So again, not sure why Windows 7 64bit is a requirement for development. Anyway, make sure you run the appropriate command above as administrator, otherwise you may receive an error stating “The module was loaded but the call to DllRegisterServer failed with error code 0x80070005” (which is a permissions error).

Compiling Examples

The final part of this article will focus on compiling and using the examples that come with the SDK.  The one I’m going to point out here is the picker example.  This example uses the native device’s UI to display a list of options.  The example is actually a console application that has no graphics, so it is actually using the local device’s display mechanisms rather than trying to do some trickery on the XenApp server side.  So, here we go…

  1. Browse to \Program Files (x86)\Citrix\MobilitySDK\samples\native\showpicker
  2. Double click on showpicker.sln to open the solution in Visual Studio
  3. Build the solution by pressing F6
  4. This will create an executable in \Program Files (x86)\Citrix\MobilitySDK\samples\native\Win32\Debug\showpicker.exe
  5. Copy this showpicker.exe to your XenApp 6.5 server (I copied mine to \Program Files (x86)\Mobility\picker\showpicker.exe)
  6. Publish the application via Citrix AppCenter
  7. Launch the published application using an Android device (or emulator) with the latest Citrix Receiver installed.

NOTE: You may receive an error message that states “The program can’t start because MSVCR100D.dll is missing from your computer…”  Here’s why – the solution was built in debug mode.  Thus, debug DLL’s (notice the “D” in the DLL name) need to be on the XenApp 6.5 server.  Here is what you can do:

Copy:

  • From: \Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC100.DebugCRT\msvcr100d.dll on your development machine
  • To: \Windows\SysWOW64\msvcr100d.dll on your XenApp 6.5 server
You could technically build the solution in Release mode instead of Debug mode and be okay, but to perform remote debugging, you will want to have the debug DLL on your remote machine.  Speaking of debugging, here are 2 great write-ups on how to debug the mobile applications:

 

The Result

Here is what the end result looks like.

Once you pick one of the colors, the console application will give you feedback on the chosen item.  When the appropriate receiver is available for iOS, then the native iOS selector would be shown with no code changes on the developer’s part.  That is pretty cool!

In the next article on this topic, I will show you how to use mobile device orientation to change what is displayed to an end user.  The example will include data and graphics.  Stay tuned…

Setting up an Android Emulator for use with Citrix XenApp 6.5 Mobile Application SDK

One of the coolest SDKs I’ve seen come out in quite a while is the Citrix XenApp 6.5 Mobile Application SDK. As of this writing, only the Android version of the Citrix Receiver is supported so I will show you how to set up an Android emulator with the Citrix Receiver for testing purposes.

One of the coolest SDKs I’ve seen come out in quite a while is the Citrix XenApp 6.5 Mobile Application SDK. Citrix defines the XenApp 6.5 Mobile Application SDK as “… a rich tool kit for developers to write touch-friendly, mobilized applications that are hosted on Citrix XenApp and delivered to any device with Citrix Receiver. These mobilized applications are able to leverage a wide set of mobile device functionality including GPS, sensors, cameras, and device buttons in the same way that locally running, native applications do.”

As of this writing, only the Android version of the Citrix Receiver is supported (iOS is on the way).  Since I do not own any Android devices and I was anxious to get started, I had to set up an emulator and install the Citrix Receiver to get going with the SDK.  Here is how I did it.

 

Install the Android SDK

Go to the Android SDK download page (http://developer.android.com/sdk/index.html) and pick the correct installer for your platform. I’m using Windows, so I chose the .exe installer file.  After you run this .exe, you still do not have the emulator.  The reason for this is the Android SDK archive initially contains only the basic SDK tools. It does not contain an Android platform or any third-party libraries. You must install the Platform-tools and at least one version of the Android platform using the SDK Manager.

Android SDK Manager

I installed the Android SDK Platform-tools and all options for Android 4.0.3.

After the install completes, be sure to add %ProgramFiles%\Android\android-sdk\platform-tools to your PATH environment variable.  This will be handy later for installing the Citrix Receiver.

 

Create an Android Virtual Device

After the installs complete, you can launch Android Virtual Device Manager (AVD Manager). This can be found in the Windows start menu under Android SDK Tools \ AVD Manager. AVD Manager is used to create various virtual devices running the Android OS.

Android Virtual Device for XenApp 6.5 Mobile Appliction SDK
As you can see, I created an Android 4.0.3 device with 100 MiB of local storage. The more storage you add to your AVD, the longer it will take to boot. Since this AVD is only being used for XenApp 6.5 testing, I only allocated 100 MiB. The first boot of your AVD will take a little longer than subsequent boots.

 

Download the Citrix Receiver for Android

Now that we have a functioning Android emulator, we need to get the Citrix Receiver installed. The first thing we need to do is download the .apk (Android Package) file. Normally, I would just go to http://www.citrix.com/receiver and choose “Android”. But, as of this writing, when you do that, you are redirected to the Android Marketplace. Unfortunately, Android Marketplace does not work on the Android Emulator. So, here is what you can do instead:
Go to http://www.citrix.com/downloads and choose “Receiver for Android” from the drop down list. From there, you can select the Android client and download the .apk.

 

Install the Citrix Receiver for Android

Ok, so now we have a functioning Android emulator and the Citrix Receiver downloaded. The final step is to install the Citrix Receiver onto the emulator. Here’s how:

  1. Copy the .apk file to %ProgramFiles%\Android\android-sdk\tools
  2. Open a command prompt and change the directory to %ProgramFiles%\Android\android-sdk\tools
  3. With the AVD you created running, execute the following command:
adb install <name of Citrix Receiver>.apk

Citrix Receiver for Android

 

You now have a fully functional Citrix Receiver running on an Android emulator.  My next post shows you how to set up a development environment to utilize the Mobile Application SDK and compile some of the examples.