Phone Gap App with dynamic file name

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
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:

Phone Gap App with dynamic file name

Post by jac53 »

After being successful with the PhoneGap example (hard coded name) I would like to do the following:
Create a grid program with a hidden field containing a unique name which I am building inside my RPG to be used as the picture name.
In the App.js there is comment stating that get() API should be use for dynamic names.
I was thinking to execute the get(hidden field) like Takepicture(get(hifield));
Modify the Takepicture() to receive my hidden field as a parameter and override the picture.jpg with my new dynamic name in order to display back the picture.
Is this make sense?
What is the best way to accomplish this?

Thanks in advance for your help.
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: Phone Gap App with dynamic file name

Post by Scott Klement »

In this example, I have a hidden output box on the screen with an 'id' (not bound field name -- it needs to be the 'id') of "shpID". I wanted my upload to be named "shipmentXXXXX.jpg" where XXXXX = the shipment id.

So, I coded it like this:

Code: Select all

function takePicture() {

   var pictureName = "shipment" + get("shpID") + ".jpg";  

   pui.capturePhoto({ 
           dir: "/www/profoundui/htdocs/profoundui/userdata/images/shiplist", 
      fileName: pictureName,    
     overwrite: true, 
       handler: function(response) { 
          if (response.success) pui.click();  
          else alert(response.error);  
       }  
   });

}
Will something like this work for you?
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: Phone Gap App with dynamic file name

Post by jac53 »

Hi Scott:

Thanks for your example. I put it to work my app. I am having problem redisplaying the picture.
I tried different things in the image source but without success. Any help will be appreciated.

Thanks,
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: Phone Gap App with dynamic file name

Post by jac53 »

Hi Scott:
Discard my question.
Finally I put it to work. I bound a field to the image source and build the url in my RPG.

Thanks for all your help.
aashton
New User
Posts: 1
Joined: Wed Jan 09, 2013 2:17 am
First Name: ashton
Last Name: noble
Company Name: trade mac
Phone: iphone4
City: Delhi
State / Province: Outside Canada/USA
Zip / Postal Code: 011011
Country: India
Contact:

Re: Phone Gap App with dynamic file name

Post by aashton »

Dynamic Page Loading
The main HTML page for our application contains a div element to display dynamic content. It also loads the JavaScript code used by our application. Referring to the HTML code below, the container div is where we will place our content.
<body id="body" onload="init();">
<h3 id="header">PhoneGap Dynamic Pages Demo</h3>
<div id='container'></div>
</body>

____________
Mobile Dialers
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest