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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 63
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?

Developer
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
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

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;
    }
}

 

 

 

Highlighted
Developer
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).

Developer
Posts: 63
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.