Wednesday 15 August 2012

android - Titanium.Network.HTTPClient caches responseData. How do I prevent that? -



I was thinking that titanium network Caching from my responseData to the HTTP client ? This directory is being done on Android in /sdcard/Android/data/com.packagename/cache/_tmp , following this method for file their file name tihttp-XXXXXXXXXXX.mp / <> Does. I have already implemented custom cache in the app personal data directory so I do not have to need this twice and users have to waste precious data space on my SD card. Plus the cash in the sdcard is not always there.

  var client = Ti.Network .createHTTPClient ({onload: function (e) {Ti .API.info ("Received Text:" + this.responsetext); Alert ('Success');}, Timeout: 5000, Cash: Incorrect,});   

The above work only for the iPhone after a while, but if you set the header directly to the request, then it should work for both iPhone and Android:

  client.setRequestHeader ('cache-control', 'no-cache'); Client.setRequestHeader ('cache-control', 'no-shop'); It should be said after opening, but before the request is sent, i.e.:  
  var client = Ti.Network.createHTTPClient (); Client.open ('receive', 'http: //google.com/'); Client.setRequestHeader ('cache-control', 'no-cache'); Client.setRequestHeader ('cache-control', 'no-shop'); Client.send ('good');    

No comments:

Post a Comment