2014년 11월 28일 금요일

Emulator and web connectivity

First day and first try at this. I need some advice. I have set up a button and on click I want it to go to a web API and this will return json data. I then want to display the json data in a listbox. I think the blocks I have put together work but the emulator gives me nothing. I am not sure where to go:

1.Does the emulator connect to the web as normal
2. Is my coding correct

If someone can help it would be very much appreciated. I am not sure how to upload the project so here is what I have set up:

One button, one web component, one list box

Button on click event it runs the following
web1 set url to (my url)
Call web1 get (definitely needs a get request)

The url is tried and tested and works well to retrieve json data from a web api

When web1 got text event
set response content to call web1 json text decode listview1 elements



Close. You need to get the ResponseContent, not set it.

Set listview1 elements to json text decode get ResponseContent.

See the stock quotes tutorial http://appinventor.mit.edu/explore/ai2/stockquotes.html



Does your 'Company network' have a firewall?  Talk to your IT person, you may have  firewall issues regarding port 8004 ... if that is blocked, no emulator.  

If you are on a company network, be aware, firewalls block lots of AI2 communicagtion paths and cause activity issues.   It is not possible to use AI2 for all functions if you are using complementary Internet use from most hotels, restaurants, hospitals, schools etc.  Their firewalls block the ability of AI2 to 'talk to itself' ... that is use the emulator.  You may be able to 'build blocks' but you may not be able to 'live test.'

That may be your issue.



set listview1 elements to call web1 json text decode get response content 


댓글 없음:

댓글 쓰기