I'm setting up an OTA download for a BlackBerry application. I have a folder containing a JAD files with multiple COD files, along with a simple HTML download page with a link to the J开发者_JAVA百科AD file. The download works fine the first time for each device, but when I place an updated version (new JAD and COD files) with an incremented MIDlet-Version:
in the JAD file and download it from the device, the display page for the download still shows the old version, and when I click the download button the dialog asks if I want to replace the old version 1.0 with the new version 1.0.
If I go to options/cache and clear the cache and then reload the download page and click the OTA link, it now correctly shows the new version available as 1.1. So it seems like my browser on the device is caching the old JAD file.
Since clearing the browser's cache fixes the problem, is there any way I can do this programmatically? I'm opening the browser instance from my BB app anyway, so it would be easy to do, if possible. Alternatively, is there any property/attribute I can set in the JAD file that will prevent it from being cached?
For security reasons, BlackBerry doesn't allow 3rd party apps to manipulate the browser history or cache. However, a workaround for the problem you are seeing is to add the Cache-Control: no-cache
HTTP header to the page serving the .jad file. This will force the BlackBerry browser to look for a new version every time.
Example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<title>my web Page</title>
</head>
<body>
</body>
</html>
精彩评论