jarvisjordan / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Infinite loading loop of expired tiles when in offline mode #439

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Have map with expired tiles on SD card
2. Turn off Internet connection or disable tiles downloading
3. Display map and look into logs

What is the expected output? What do you see instead?
Expected: After failed download, map stops trying to download tiles
What happens: tiles provider goes into infinite loop reloading expired tiles 
from file and failing to download newer.

What version of the product are you using? On what operating system?
osmdroid 3.0.10, tested on Android 4.0.4 (Xperia Neo V) and 4.2.1 (ASUS TF300T)

Please provide any additional information below.

After some code research I've found out how it works:
1. Expired tile is loaded from file. Download is disabled
2. MapTileProviderBase adds this expired tile to cache 
3. MapTileProviderBase sends MAPTILE_SUCCESS_ID message through 
mTileRequestCompleteHandler, which leads to calling invalidate() on MapView
4. During MapView's repaint all expired tiles are set for re-load (added to 
mPending in MapTileModuleProviderBase)
5. GoTo 1.

My fast workaround is to check at point 2. if there is already a tile in the 
cache. If there is one, don't send MAPTILE_SUCCESS_ID message, as nothing has 
changed. This way I'm breaking the loading loop.

Original issue reported on code.google.com by tomasz.k...@gmail.com on 13 Jun 2013 at 8:07

GoogleCodeExporter commented 8 years ago
Create your own tile-provider array and when you create your 
MapTileFilesystemProvider, pass it Long.MAX_VALUE for the pMaximumCachedFileAge 
parameter. This will effectively make it so that tiles don't expire.

Original comment by kurtzm...@gmail.com on 14 Jun 2013 at 1:50

GoogleCodeExporter commented 8 years ago
Nice workaround, but I'd like to re-download expired tiles from time to time :)

Original comment by tomasz.k...@gmail.com on 24 Jun 2013 at 12:46

GoogleCodeExporter commented 8 years ago
Is this related to issue 289. Maybe even the reason for it?

Original comment by notdiffi...@gmx.net on 23 Nov 2013 at 2:10