Phonegap issues
-
- 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
After recreated the photo application using the new release 4.1.6 I am getting the following:
- Attachments
-
- image.jpg (631.74 KiB) Viewed 1721 times
-
- image.jpg (621.85 KiB) Viewed 1720 times
-
- image.jpg (241.17 KiB) Viewed 1717 times
-
- 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
Here are the rest of the screenshots.
- Attachments
-
- image.jpg (266.54 KiB) Viewed 1714 times
-
- image.jpg (263.89 KiB) Viewed 1714 times
-
- 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
How can we remove the "no image selected" pop up? When we tap use, we get undefined.
-
- 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
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?
Or is this message popping up automatically when calling the pui.photoCapture() API?
-
- 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
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,
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,
-
- 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
Can you post the takePicture() routine that you are referring to?
-
- 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
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
-
- 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
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.)
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:
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?
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);
}
});
}
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);
}
}
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?
-
- 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
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?
http://profoundlogic.com/forums/phpbb3/ ... =53&t=1276
Does that sound right? Did this happen after you upgraded ProfoundUI to the latest version?
-
- 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
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.
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.
Who is online
Users browsing this forum: No registered users and 2 guests