Android urlConnection 设置 UseCache(false) 不起作用
Android urlConnection setUseCache(false) doesnt work
我目前正在使用此代码。当设备没有互联网时它工作得很好(它不使用缓存)但是当我更新 txt 文件时,它不会在应用程序中更新它,它使用以前的文件。
URL url = new URL("http://www.myhost.com/ygs/somefile.txt");
URLConnection urlConnection = url.openConnection();
urlConnection.setUseCaches(false);
我该怎么办?
向查询字符串添加随机数或时间字符串URL
url = new URL("http://www.myhost.com/ygs/somefile.txt?r="+Math.random());
我目前正在使用此代码。当设备没有互联网时它工作得很好(它不使用缓存)但是当我更新 txt 文件时,它不会在应用程序中更新它,它使用以前的文件。
URL url = new URL("http://www.myhost.com/ygs/somefile.txt");
URLConnection urlConnection = url.openConnection();
urlConnection.setUseCaches(false);
我该怎么办?
向查询字符串添加随机数或时间字符串URL
url = new URL("http://www.myhost.com/ygs/somefile.txt?r="+Math.random());