Phonegap issues

Use this board to ask questions or have discussions with other Rich Displays users.
jac53
Experienced User
Posts: 170
Joined: Mon Jul 19, 2010 2:40 pm
First Name: Jorge
Last Name: Cabrera
Company Name: Lennar Corp
Phone: 305-229-6400
Contact:

Phonegap issues

Post by jac53 »

After recreated the photo application using the new release 4.1.6 I am getting the following:
Attachments
image.jpg
image.jpg (631.74 KiB) Viewed 1718 times
image.jpg
image.jpg (621.85 KiB) Viewed 1717 times
image.jpg
image.jpg (241.17 KiB) Viewed 1714 times
jac53
Experienced User
Posts: 170
Joined: Mon Jul 19, 2010 2:40 pm
First Name: Jorge
Last Name: Cabrera
Company Name: Lennar Corp
Phone: 305-229-6400
Contact:

Re: Phonegap issues

Post by jac53 »

Here are the rest of the screenshots.
Attachments
image.jpg
image.jpg (266.54 KiB) Viewed 1711 times
image.jpg
image.jpg (263.89 KiB) Viewed 1711 times
jac53
Experienced User
Posts: 170
Joined: Mon Jul 19, 2010 2:40 pm
First Name: Jorge
Last Name: Cabrera
Company Name: Lennar Corp
Phone: 305-229-6400
Contact:

Re: Phonegap issues

Post by jac53 »

How can we remove the "no image selected" pop up? When we tap use, we get undefined.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Phonegap issues

Post by Scott Klement »

When a JavaScript variable has not been assigned any value, it will be considered "undefined". Is it possible that you are doing something like alert(myvar) where myvar has not been set to a value?

Or is this message popping up automatically when calling the pui.photoCapture() API?
jac53
Experienced User
Posts: 170
Joined: Mon Jul 19, 2010 2:40 pm
First Name: Jorge
Last Name: Cabrera
Company Name: Lennar Corp
Phone: 305-229-6400
Contact:

Re: Phonegap issues

Post by jac53 »

Hi Scott:

The steps were:
I pressed the Take Picture button.
I got the camera ready
I pressed the camera icon
I got the photo
I pressed the Use botton
I got the index.html undefined error message

Thanks,
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Phonegap issues

Post by Scott Klement »

Can you post the takePicture() routine that you are referring to?
jac53
Experienced User
Posts: 170
Joined: Mon Jul 19, 2010 2:40 pm
First Name: Jorge
Last Name: Cabrera
Company Name: Lennar Corp
Phone: 305-229-6400
Contact:

Re: Phonegap issues

Post by jac53 »

Here are the final Phone Gap files that we added to our XCode Project from the ProfoundUI Installation on the iSeries.
Attachments
iOS Phone Gap Files-Lennar_20121109.zip
(207.33 KiB) Downloaded 160 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Phonegap issues

Post by Scott Klement »

Okay, so I extracted this code from the app.js that you have in your project. (I don't know if you wrote this, or if you copy/pasted it from one of our examples -- it may be that our examples aren't very complete.)

Code: Select all

function takePicture() {
   pui.capturePhoto({
      dir: "/www/profoundui/htdocs/pictures",
      fileName: "picture.jpg",
      overwrite: true,
      handler: function(response) {
        if (response.success) pui.click();
        else alert(response.error);
      }
   });
}
You'll notice that you've procided a "handler" function that is to be called when the photo capture process is finished. The handler either calls pui.click(). (Which, more or less, presses ENTER for the user if the photo upload was successful) or runs the alert() Javascript function to display the error message.

The reason you're getting a popup box that says "undefined" is because the response.error variable has not been set to anything -- so when you do alert(response.error) it displays "undefined" in the box.

I think maybe that handler function should do something like:

Code: Select all

      handler: function(response) {
        if (response.success) {
           pui.click();
        }
        else if (response.error===undefined) {
           alert("photo cancelled");
        }
        else {
           alert(response.error);
        }
      }
This is completely untested -- it's just off the top of my head.

The point is: You can write any code you want to handle the situation... maybe you just want to ignore the error? No problem... just remove the alert(). Write the code to do whatever you want it to do...

Does that make sense?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Phonegap issues

Post by Scott Klement »

I was thinking some more about this issue, and was wondering if maybe it's the same issue as the one in the following thread?
http://profoundlogic.com/forums/phpbb3/ ... =53&t=1276

Does that sound right? Did this happen after you upgraded ProfoundUI to the latest version?
jac53
Experienced User
Posts: 170
Joined: Mon Jul 19, 2010 2:40 pm
First Name: Jorge
Last Name: Cabrera
Company Name: Lennar Corp
Phone: 305-229-6400
Contact:

Re: Phonegap issues

Post by jac53 »

I got the code from the documentation example.
I did the change and now I am getting Photo cancelled.
My problem is when I click USE (upload the picture) after I took the photo.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests