Setting up a camera app

You must add the following permissions to your app's bar-descriptor.xml file to use the features of the Camera APIs.

  • use_camera: This permission grants your app the ability to use the camera.
  • access_shared: This permission allows your app to save captures.
  • record_audio: This permission allows your app to use the device microphone.

To learn more about the bar-descriptor.xml file, see The bar-descriptor.xml file.

Prerequisites for using Camera APIs

When you're creating your app using C++ and you want to use the Camera APIs, you need to import the Camera libraries by adding the following line to your project's .pro file. This step is not needed if you're creating your app using QML.

LIBS += -lbbcascadesmultimedia -lbbmultimedia -lbbsystem

For more information on linking against libraries, see Linking against libraries.

Each API will show you which libraries you need to include into your app's header file.

You can add using statements to your app's source code to reduce the amount of code you have to write when declaring variables. Here are the using statements found in the C++ version of the camera sample app used in this discussion.

using namespace bb::cascades;
using namespace bb::multimedia;
using namespace bb::cascades::multimedia;

Last modified: 2014-09-29

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus