Page 1 of 1

Problems with REST call to localhost

Posted: Wed Oct 17, 2012 10:24 pm
by Jonathan Clarke

Dear All,

I've got a localhost webserver running, and I'm trying to get my Tiggzi app make a REST call to it. The same call works in both a browser and cURL, but not the Tiggzi app, either as a browser tab test or as an installed apk. Is this a known problem, or can anyone help me on this please?

Thanks,
Jonathan.


Problems with REST call to localhost

Posted: Wed Oct 17, 2012 10:27 pm
by maxkatz

Tiggzi is running in the cloud so it doesn't know what is localhost. It works for you because your browser (or command line with curl) is able to access your local server. You could make your server public on the Internet and use an IP address.


Problems with REST call to localhost

Posted: Wed Oct 17, 2012 10:34 pm
by Jonathan Clarke

Thanks for the quick reply, but the reason why tried this route of testing is that I original built it as an apk, and loaded it up on an Android emulator. I have an equivalent handwritten Android app that uses the same REST call, with the appropriate 10.0.2.2. "local" IP, which works, but the Tiggzi build did not. I didn't want to expose the webserver to the outside work, so I guess the only way is to export the Tiggzi as an eclipse project and debug it the old skool way!


Problems with REST call to localhost

Posted: Wed Oct 17, 2012 10:38 pm
by maxkatz

Hmm.. I'm not sure how the app on the phone is able to access your local host.. unless you are using a VPN..?

If you need to try the service.. one option is to use the Echo feature: http://help.gotiggr.com/documentation...


Problems with REST call to localhost

Posted: Wed Oct 17, 2012 10:41 pm
by Jonathan Clarke

I just use the standard Android "internal" IP address for localhost: 10.0.2.2. The emulator works just fine using that, to make all my REST calls to a webserver on the same machine. I think I'll try the eclipse source export approach first. Thanks for your help.


Problems with REST call to localhost

Posted: Wed Oct 17, 2012 11:09 pm
by Jonathan Clarke

I understand why it's not working now. I didn't realise that the REST call would actually be done from a .js file! I thought Tiggzi was a "hybrid" mobile app builder, meaning that it would be possible to have some "behind-of-the-UI" functionality in there too. Is it not possible to specify that a REST call can be done from an Activity or Service? What happens if periodic behaviour is required, independent of a button click or something? My original Android does background, but I was looking at a builder alternative, so that I could quickly take advantage of HTML5 and jQuery. Is it possible to specify background stuff using Tiggzi?


Problems with REST call to localhost

Posted: Thu Oct 18, 2012 2:00 am
by maxkatz

You can build hybrid apps in Tiggzi, but you always start with an HTML5 mobile app. Click Export, to export the app as hybrid (PhoneGap). PhoneGap library is included in every app (unless you change the type to mobile web).