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: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2
Accepted Solution

Check permissions

We need access to restricted functionality on the device. The device permissions the application requires can be specified in the BAR application descriptor file.

 

Is there a way to check if permissions are denied or allowed by the user?

 

The API provides a class ApplicationPermissions.

 

#include <bb/platform/bbm/ApplicationPermissions>
 
But it can only be used to check BBM permissions.
Highlighted
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Check permissions

There's no direct, unified API for this (yet). For now, attempt to perform one of the restricted actions and catch any exceptions that are raised.

For example, if you try to do a directory listing on the shared/ subfolders and don't have access_shared granted by the user, you should get a permission violation.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 217
Registered: ‎09-18-2009
My Device: Z10
My Carrier: O2

Re: Check permissions

Okay, thanks.

 

Hopefully, the API comes with the next release of the Native SDK. Unfortunately, the exceptions which will be thrown are not documented. So, there is no known exception to react on. For instance, if a network request fails because of missing permissions we want to show a popup. Showing this popup always when an exception is thrown can be wrong.

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Check permissions

At least so far, I've never seen a permission that prevents basic network access. In spite of the existence of access_internet and the docs, I don't think it's ever been required yet. Maybe it was added recently... i haven't tested in a couple of versions.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!