Developing Enterprise Apps for the Work Space of BlackBerry 10 Part 1: File System Access & Application Testing

Enterprise

Congratulations! You’ve decided to take the journey down the path of building an Enterprise app for BlackBerry 10. This means that you’re targeting BlackBerry Balance enabled devices and therefore have a unique set of requirements. To level-set, I’ll provide you with a quick overview of BlackBerry Balance. It’s a technology that creates two distinct spaces (work space & personal space) on BlackBerry 10 devices that are connected to an organization’s BlackBerry Enterprise Service 10. One major benefit is that users can keep personal apps & data separated from work apps & data. Users administer the personal space, while organizations administer the work space. It’s a powerful technology and one of the most outstanding enterprise oriented features of BlackBerry 10.

As a developer building BlackBerry 10 apps for the enterprise, you’re targeting the work space of a BlackBerry Balance enabled device. Developing for the work space differs from developing for the personal space. This two-part blog post series has been created to highlight a few items that you should plan for when building for the work space. A brief list of development considerations are as follows:

  • File System Access
  • Application Testing
  • Application Invocation
  • Push
  • Networking Constraints

We’re going to break this up into digestible bits and only cover File System Access & Application Testing in this post. See Part 2 for Push, Application Invocation, and Networking Constraints.

File System Access

It’s not uncommon for an application to need to access data stored on the device during the lifespan of an instance of the app. Whether that is for temporary or permanent persistence, accessing the File System differs between the work & personal spaces. Let’s talk a little bit about the file system; I’ll be using Cascades for our discussions.

Apps that run on BlackBerry 10 devices run in their own sandbox and have access to a directory structure within that sandbox. Apps also have access to a shared folder structure on the file system of the device. The working directory is where the application is started and is often referred to as the current directory. Cascades provides classes & functions that allow you to gain access to the application’s sandbox.

QDir::currentPath() – returns the path to your app’s working directory. The path returned by this function differs between the work space & personal space:

Personal Space Working Directory

/accounts/1000/appdata/[yourappidhere]

Work Space Working Directory

/accounts/1000-Enterprise/appdata/[yourappidhere]

Because there are two distinct spaces on the device, there are essentially two file systems and therefore, two different working directories. This is important to note, especially when storing & retrieving from the file system. Also, if you’re using the Target File System Navigator feature from Momentics IDE to debug an app on a device running BlackBerry 10.0 or BlackBerry 10.1 OS, you’ll notice the Personal Space directory structure shown above, NOT the Work Space directory structure. Cascades apps on 10.0 and 10.1 devices debugged using the Momentics IDE can only communicate with the Personal Space (More on this in the Testing section of this post).

Relative to the aforementioned working directory, the app can access the following folders:

chart-w600

The shared directory provides the benefit of allowing your app and other apps to access the contents of that directory. This allows you to build a powerful solution, leveraging functionality from co-existing apps in the Work Space, which also write to the shared directory. To access the shared directory programmatically, the code would look like:

QDir::currentPath() + “/shared/camera/img123.png”

A good resource for BlackBerry 10 File System layout is here. Keep in mind the differences in the two directory structures as you’re building your app.

Application Testing

When it comes to testing mobile apps, the most common approach is to side load the application and to begin the fun part – watching the app come alive on a device! On BlackBerry 10 OS versions 10.0 & 10.1, side loading of apps onto BlackBerry balance enabled devices will deploy the app to the personal space. That’s not necessarily a bad thing as you’re able to accomplish some testing in this space. For instance, you have the benefit of using the source level debugging feature through the Momentics IDE to help you trace through code. Just keep in mind the considerations mentioned above when testing in the personal space. Remember that no truer test exists than putting your app into the work space.

To deploy the app to the work space on devices running BlackBerry 10 OS version 10.0 or 10.1 you need to work with your BlackBerry Enterprise Service 10 administrator. You essentially build and code sign the app, give the admin the .bar file (the application executable) and have the admin deploy it to the device.
Beginning at BlackBerry OS version of 10.2, you can side load apps into the work space (Yippee!) There are a few considerations:

  • The administrator of the BlackBerry Device Service has to set the IT policy Development Mode Access to Work Space rule to Allow to let you test apps in the work space.
  • Only BlackBerry Enterprise Server 10.1.3or later supports the Development Mode Access to Work Space IT policy.
  • The IT policy Development Mode Access to Work Space rule takes effect only if the Restrict Development Mode rule is set to No.
  • If the Development Mode Access to Work Space rule is disabled, apps that you previously tested in the work space are removed.
  • You can overwrite the apps that your administrator pushes, but if the Development Mode Access to Work Space rule is disabled, your app is removed and isn’t reinstalled.

Just like with BlackBerry 10.0 and 10.1 OS, you can take advantage of the features that the Momentics IDE provides you in terms of tracing code and much more. Although this is a powerful feature, it’s still not a substitute for deploying the app into the work space through the BlackBerry Enterprise Server. In addition to side loading, I suggest always including the BlackBerry Enterprise Service 10 deployment phase in your testing process to fully cover your bases.

That’s it for now! Remember to check out Part 2 of this series (coming soon) for insights on Push, Invocation and Networking constraints of the work space. Feel free to bookmark http://developer.blackberry.com/ as a development resource. There you’ll find the tools you need, API references, samples, support forums and much more!

About Maurice White

Maurice White is a Sr. Enterprise Developer at BlackBerry, providing guidance to their largest customers with the design & development of solutions for the BlackBerry platform. Maurice leverages his over 13 years of software development experience in helping Enterprise customers deliver solutions and mobilize their workforces. Follow him on twitter @MoReeseMo

Join the conversation

Show comments Hide comments
+ -
blog comments powered by Disqus