Start a new topic

How can I pass data/parameters to ARchitect view ?

How can I pass data/parameters to ARchitect view ?

1 person has this problem
1 Comment


Hi all,

I've seen in several posts that there is something like ARchitectWorld.callJavaScript function. However I can't get how to use it in my code.

Let's say I want to pass radar distance value from my native Titanium view (i.e. slider value) to ARchitectWorld view as well as the URL to my WebService that reply POIs in JSON format. So, basically I need to pass these 2 parameters to instruct ARchitect view to do a call to my WebService by using the passed URL and the Km (radar distance) to get POIs in JSON format.

My code is based on 4_ObtainPoiData_3_FromWebservice sample code provided with Titanium Sample App. 

From my native view I am saving my parameters/settings in a Settings.json file locally, with the following format:

{"URL":"http://terraserver.cloudapp.net/app.php/api/getPoisNear/","Km":"0.02"}

 

Then I want ARchitect view to use this JSON (setting.json) to get these 2 parameters, so I in my fromWebservice.jsl file, I can do the call:

var serverUrl = ServerInformation.POIDATA_SERVER + lat + "/" + lon + "/" + ServerInformation.POIDATA_SERVER_ARG_KM_DIS;

 

So, question is: How could I load the local setting files in ARchitect view (index.html or fromWebservice.jsl), parse its content (JSON) and replace the following variables as:

ServerInformation.POIDATA_SERVER = jsonData.URL and ServerInformation.POIDATA_SERVER_ARG_KM_DIS = jsonData.Km

 

where jsonData should be the parsed data from settings.json local file.

 

Regards,

Flavio

 

 
Login or Signup to post a comment