Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Refreshing data not working on devices - works in browser.

To reproduce the error, do the following:

  1. Check the id of the first post in the JSON feed:
    http://schoolsays.co.uk/schools/broal...

  2. Open the app (compiled app or in Appery tester) and click on 'News' button (bottom left).

  3. Once loaded, wait 5 minutes and then check the id of the first post in the JSON feed again to confirm it has updated.

  4. Once you are sure the feed has updated, click the refresh button on the app (top right).

    You should see that, despite the fact that the JSON feed has updated, the data in the app is not refreshing.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Refreshing data not working on devices - works in browser.

The problem is related with jsonp request. You use jsonp, which is updated automatically, but the application sees it's previous value, because the URL is not changed, to it reads data from cache.

Please add a time-related parameter to that service, e.g. timestamp, so your URL will be:
prehttp://schoolsays.co.uk/schools/{id}/api/get_posts/?timestamp=1467387152666/pre

do do that, please add a request parameter timestamp to that service, and add

codetimestamp: new Date().getTime()/code to the execude method

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Refreshing data not working on devices - works in browser.

Hi Sergiy,

Thanks for that. Your solution works.

I have published many identical apps using JSONP without the timestamp and they refresh without problem. Why wasn't this an issue previously?

Chris

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Refreshing data not working on devices - works in browser.

Did you publish Cordova applications, built by Appery.io? If so - what libraries version did you use there? Do they have the same type of URLs?

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Refreshing data not working on devices - works in browser.

Yes, identical Cordova apps built with Appery. Same URLs. Only difference is they used libraries v3.0 (instead of v3.1).

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Refreshing data not working on devices - works in browser.

Could you change library of the last your app to 3.0 and check it again?

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Refreshing data not working on devices - works in browser.

Hi Sergiy,

I tried changing the libraries back to 3.0 last week and it didn't help. Also, I have since discovered that one of the problem apps was already using libraries 3.0 and still displayed the same problem, so I don't think that was an issue with the libraries.

If it is useful to know, the three affected apps were all created using the same 'School App' plugin (the previous version of the plugin with the same name on my account)

Anyway, your solution works, so perhaps we should consider this thread closed, unless you see value in continuing to investigate.

Thanks for your help.

Chris

Return to “Issues”