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
New Developer
yoan
Posts: 13
Registered: ‎12-17-2012
My Carrier: Telenor

Create/Open Camera on button click (not opened from start)

Hi,

 

Trying to find a sample where the camera is opened from a button click. All examples i can find the camera view is already opened from start. 

 

Any help to point me in the right direction would be much apprisiated!

 

/Johan

Please use plain text.
Developer
zezke
Posts: 816
Registered: ‎12-12-2010
My Carrier: Mobile Vikings

Re: Create/Open Camera on button click (not opened from start)

Do you want to integrate a custom camera view in your app or do you want to invoke the camera?

-------------------------------------------
Your like is much appreciated!
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
New Developer
yoan
Posts: 13
Registered: ‎12-17-2012
My Carrier: Telenor

Re: Create/Open Camera on button click (not opened from start)

I just want to invoke the camera, get the image taken, upload it to my server. 

Please use plain text.
Developer
billbsb
Posts: 72
Registered: ‎03-25-2011
My Carrier: None

Re: Create/Open Camera on button click (not opened from start)

Hi there! Any luck with it? I'm trying to implement the same thing.

 

Have you seen this other thread? http://supportforums.blackberry.com/t5/Cascades-Development/Invoke-camera-card-in-qml/m-p/2319141/hi...

 

Cheers!

Please use plain text.
BlackBerry Development Advisor
PBernhardt
Posts: 155
Registered: ‎12-16-2008
My Carrier: Bell

Re: Create/Open Camera on button click (not opened from start)

Do you want to invoke the camera card, or build the camera UI inside your application? Invoking the camera card will require a bit of C++ (as mentioned in that thread), but can definitely be done. Starting and stopping the camera viewfinder from inside your app is also pretty easy, and can be done in QML. I believe the BarcodeScanner app starts the viewfinder after you press on the screen.

 

https://github.com/blackberry/Cascades-Samples/tree/master/barcodereader

 

You can just call camera,open(CameraUnit.Rear) at any point in your app, really.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt
Please use plain text.
BlackBerry Development Advisor
PBernhardt
Posts: 155
Registered: ‎12-16-2008
My Carrier: Bell

Re: Create/Open Camera on button click (not opened from start)

Actually, why do you want to delay opening the camera? Even if you don't want it to be the first thing you see in the app, you probably want to have it off on it's own page.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt
Please use plain text.
Developer
billbsb
Posts: 72
Registered: ‎03-25-2011
My Carrier: None

Re: Create/Open Camera on button click (not opened from start)

On the docs page states that you can invoke the Camera app but it never mentions you can invoke it via QML so maybe this could be clearer.

 

But then I saw on this other docs page that you can already invoke some Cards in QML using the InvokeActionItem but apparently it doesn't work for the Camera app. So this is actually the new feature that I need. The work around is to do everything in C++ so It's not really high priority.

 

While reading all those pages I realized something: I want to integrate the device's cameras on my application without having to implement a complex camera module. I'm not an expert on camera stuff like focus, exposure, face detection and so on. But I know there's a high change that the user has other dedicated, feature rich Camera apps installed on their device so I want to be abble to leverage them.

 

But I guess this is not possible now, right? I was expecting to find something like bb.action.CAPTURE so I could invoke any app that can take pictures. Should this be another feature request?

 

I hope this is clear.

Cheers.

 

Please use plain text.
BlackBerry Development Advisor
PBernhardt
Posts: 155
Registered: ‎12-16-2008
My Carrier: Bell

Re: Create/Open Camera on button click (not opened from start)

InvokeActionItem is a specialized class for automatically handling invocation of a certain subset of targets. It's really nice because it will do things like give you the correct icon, and handle the GUI to select the target you want to share to. It doesn't support any sort of generic invocation right now, unfortunately.

 

For things like the camera card specifically, you will notice that there is no onChildCardDone funciton or similar, so there is no way to get data back from an InvokeActionItem to begin with. This is definitely FR territory, so if you want to see it, please log it on the DIT.

 

If you want to invoke other apps registering for the bb.action.CAPTURE action, right now you would have to build the GUI yourself, but it would be possible. Might be a good FR to have that done in a generic way as well.

 

You probably don't want to build a camera UI yourself if you aren't doing something specific with that UI (ie, applying filters to the viewfinder, or drawing something over top of it). Depending on your use case, the camera card might not be the best option either. If you just want a jpeg that may or may not have been captured right now, you can use the FilePicker class. If you ask for a image, it will default to the camera folder, and have a button for the user to capture a picture right then and there. You can also do all of that right in QML.

 

I'd generally recommend the FIlePicker over the card, but it's worth considering either way.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt
Please use plain text.