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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
javoid
Posts: 174
Registered: ‎11-24-2012
My Carrier: NA
Accepted Solution

Determine if app has camera permission?

I would like to notify the user that the camera is unavailable until they turn on the camera permission.  However, the only permissions I can find in the API is under BBM, and isn't related.

 

How do I find this out?

Please use plain text.
Developer
RileyGB
Posts: 256
Registered: ‎08-06-2010

Re: Determine if app has camera permission?

Have you tried checking the allCamerasAccessible flag: https://developer.blackberry.com/cascades/reference/bb__cascades__multimedia__camera.html#allcameras... 



Follow me on twitter @RileyGB - https://twitter.com/RileyGB
View my BB10 OpenSource projects - https://github.com/RileyGB/BlackBerry10-Samples
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 539
Registered: ‎11-29-2011
My Carrier: other

Re: Determine if app has camera permission?

allCamerasAccessible may not do exactly what you want.

It may tell you that cameras are inaccessible because they are already in use by another app.

I think you ultimately want to call into authman some how to determine if you have the permission or not.

I'll have to check on this.

 

camera_get_supported_cameras() is one native API you could try using.

http://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.camera.lib_ref/topic/camera_ge...

This function calls eaccess() to determine if your app has access to the camera devices.

If you invoke it as:

unsigned int num=0;
camera_get_supported_cameras(0, &num, NULL);

Then num should contain the # of camera devices accessible.  If this # is 0, then it's safe to assume your app doesn't have permission.  Either that or you are running on a device which has no cameras :smileyhappy:

 

Cheers,

Sean

 

 

Please use plain text.