Will4455852
Posts: 0
Joined: Sun May 13, 2012 9:20 pm

How to get activate the camera and take a picture?

Hello all,
I have a question about the camera and calling the Phonegap API directly. I was following the tutorial on this site about using the camera and have had no luck getting it to work. I click the button that should open the camera application but nothing happens. Thinking it was possible the tutorial was out of date, I went over to the phonegap api documents and tried their example. I get the same result (i.e. nothing happens).

Here is my setup:

I have a simple button with a click event which calls this function:
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
alert("clicked button");
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50 });
}

For testing I put the alert into the function to be sure the function was called. I also put an alert in the "onPhotoDataSuccess" function, however that function was never called. I have a feeling that calling the native phonegap api needs to be done differently, but I am not sure how.

Any thoughts?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to get activate the camera and take a picture?

Here is what I did and it worked. I added the Camera component (from Device palette) into the page. Invoke the service on button click and it worked (I didn't do any output mappings, just was testing if the camera will open).

Will4455852
Posts: 0
Joined: Sun May 13, 2012 9:20 pm

How to get activate the camera and take a picture?

Interesting, this did not work for me. When I tap the button, nothing happens. Is it possible there is an issue with creating the release binary using build.phonegap.com instead of the one built into tiggzi? I am using that service as my certificates are already installed there and it makes testing apps on the iphone pretty painless.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to get activate the camera and take a picture?

I tested the app using Tiggzi Mobile Tester, on Android.

Will4455852
Posts: 0
Joined: Sun May 13, 2012 9:20 pm

How to get activate the camera and take a picture?

So is this an iphone related issue? The other thing I have noticed is the 'deviceready' event never fires when the app loads. Is this too an iphone related issue?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to get activate the camera and take a picture?

It should work the same way on iOS. Are you using the Camera component or the PhoneGap API directly?

Will4455852
Posts: 0
Joined: Sun May 13, 2012 9:20 pm

How to get activate the camera and take a picture?

I have tried both the component and the Phonegap API.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to get activate the camera and take a picture?

We'll test this.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to get activate the camera and take a picture?

We tested on iOS, and the camera works. If you would like us to test more, please share your app for collaboration with a href="mailto:support@tiggzi.com" rel="nofollow"support@tiggzi.com/a.

Will4455852
Posts: 0
Joined: Sun May 13, 2012 9:20 pm

How to get activate the camera and take a picture?

Ok, I have shared with support. It is a VERY simple app. One button which invokes the camera. When I test on my ios device, nothing happens.

Keep in mind that I am building the release binary via build.phonegap.com not the internal builder (as all apps I build via your builder, will not install on my ios device).

Any help would be greatly appreciated.

Return to “Issues”