If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Georgechr
Posts: 42
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None
Accepted Solution

Distinguish between personal and work space

Is there a way to distinguish (either by an event or looking at a property) whether the environment is currently operating in the personal or in the work space?

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: Distinguish between personal and work space

I don't think there's an official way, but you could look at the app home path...

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: Distinguish between personal and work space

try looking at your process' uids.  the perimeter stuff is encoded something like xxxxx1000 for personal, xxxxx1100 for corp, xxxxx1200 for enterprise (I may have those last 2 reversed).

 

eg.

const char* uid_to_perimeter(uid_t uid) {
    gid_t pgid;
    if (uid < 10000) return NULL;
    pgid = uid % 10000;
    switch((pgid % 1000) / 100) {
        case 0:
            return "personal";
        case 1:
            return "corp";
        case 2:
            return "enterprise";
        default:
            return NULL;
    }
}

 

 

 

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Distinguish between personal and work space

QNetworkInterface::allinterfaces() can probably be used as in non-personal space it always returns only 1 interface (as far as I know).

Please use plain text.
Contributor
Georgechr
Posts: 42
Registered: ‎06-28-2013
My Device: Z10
My Carrier: None

Re: Distinguish between personal and work space

Thanks for your replies! The exact thing I did to figure this out was to look at blackberry.io.home value and check if "1000-enterprise" is part of that value.

Please use plain text.