I'am making a game and make a website to store the Score Board when I call the webservise the old Score Board appears !!! I tried to open the webServise from the android browser but the browser appears the old Score Board when i "refresh" android web Browser the new one appears how can I Solve this Problem? this is my app link on the play store I need to update it soon
Asked
Modified
11 years, 2 months ago
Viewed
245 times
Part of PHP and Mobile Development Collectives
3 Answers
I am using web Service not WebView and finally I found the solution
HttpGet httpget = new HttpGet("http://example.com/dir/page.php?"+r.nextInt(1000));
putting a random number as a parameter make the request Different
thanx all
I assume you're using a WebView.
It's actually really simple. You should have Googled for "android webview disable cache" and you would see multiple resources...
WebView browser = new WebView(this);
WebSettings settings = browser.getSettings();
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
wv.addJavascriptInterface(new JavaScriptInterface(wv), "JSI"); -
private class JavaScriptInterface {
private final WebView m_wv;
public JavaScriptInterface(WebView wv)
{ m_wv = wv;
}
public void reload()
{ m_wv.reload();
} }
See more at: http://gurushya.com/customizing-android-webview/#sthash.X87HCv01.dpuf
or other way is:
webView.loadUrl( "javascript:window.location.reload( true )" );