For developers who are targeting their applications for both the work and the personal perimeter of the device, this might be a million dollar question. Sometimes it becomes necessary to dynamically determine which perimeter the user has deployed an app in.
Needless to say, BlackBerry 10 APIs are designed to be perimeter agnostic. Hence, most app developers need not worry about it. But there are cases when apps need to make decisions based on this. E.g. an app might want to encrypt data only in personal perimeter because work perimeter encrypts all data at rest by default or an app might want to receive configurations from a server based on the perimeter it is in. With that said and understood, let’s take a look at how we can determine the perimeter our application is in at runtime.
First of all, BlackBerry 10 smartphones can operate with multiple, segregated perimeters. There are really only three kinds of perimeter segmentation.
Personal Only – This is a consumer device not connected to a BlackBerry Enterprise Server. There is only one perimeter, personal.
Personal + Workspace – This is a device that is connected to a BlackBerry Enterprise Server. There is a personal section for the user’s personal applications and data (contacts, calendar, files, etc…) and a workspace section for corporate applications and data.
Workspace Only – This is a device that is connected to a BlackBerry Enterprise Server and is operating in EMM Regulated mode. In this mode there is only a workspace perimeter, no personal perimeter.
You can determine which perimeter an application is running in by using a combination of the NET_PPS_ROOT and PERIMETER environment variables.
PERIMETER = enterprise (Balance, Work perimeter)
PERIMETER = personal (Workspace Only)
PERIMETER = personal (Balance, Personal Perimeter)
PERIMETER = personal (Personal only)
NET_PPS_ROOT = /pps/services/networking/enterprise (Balance, Work Perimeter)
NET_PPS_ROOT = /pps/services/networking/enterprise (Workspace only)
NET_PPS_ROOT = /pps/services/networking (Balance, Personal Perimeter)
NET_PPS_ROOT = /pps/services/networking (Personal Only)
NET_PPS_ROOT alone can tell which perimeter your application is in, but combining the PERIMETER variable with NET_PPS_ROOT can reveal further information about the perimeter segmentation type. Let’s have a look at some example use of these two environment variables.
NET_PPS_ROOT = /pps/services/networking/enterprise) would mean a work perimeter – in either Balance or Workspace only.
PERIMETER = personal AND NET_PPS_ROOT = /pps/services/networking/enterprise) would mean a Workspace only device.
..and last but not least, here is an actual implementation of how to determine the perimeter of an application.
I know many will thank me for this post but many will be completely apathetic. That’s good! In fact, I expect most apps should not need this at all and I do not (in any way) recommend tying your application logic to which perimeter your app is in; unless, of course, you have to! Hope this helps folks. Until next time, I will be available @shadidhaque.