Closed GoogleCodeExporter closed 8 years ago
Tell me what your NetworkProvider is - is it a TileDownloader subclass, a
completely custom modular tile provider, etc...
It sounds like you have an "offline" mode for your app - how are you setting
that?
Finally what TileSource are you using?
Some possible reasons a tile provider would not get called include:
* If osmdroid is offline, the TileDownloader class will be skipped.
* If a tile provider can not service a zoom level (because of min/max zoom level of tile provider or tile source).
Original comment by kurtzm...@gmail.com
on 14 May 2013 at 12:31
Also note: "OnlineTileSourceBase classes are the only tile sources that the
MapTileDownloader can serve."
Original comment by kurtzm...@gmail.com
on 14 May 2013 at 12:31
Thanks for the quick response!
You helped me narrow it down :)
I have a NetworkManager singleton which keeps track of network state for the
app. There are three states in the state enum, ONLINE, OFFLINE and UNAVAILABLE.
Whenever an action is about to be performed which depends on, or alters the
network state, the state is updated and returned to the caller so adequate
actions can be taken depending on which state the app is in.
My NetworkProvider is a direct subclass of MapTileModuleProviderBase, and not
of TileDownloader. My TileSource is of type OnlineTileSourceBase. Based on
these two things I deduced that it probably has nothing to do with two of the
three points you mentioned:
- If osmdroid is offline, the TileDownloader class will be skipped.
- OnlineTileSourceBase classes are the only tile sources that the
MapTileDownloader can serve.
Which left me with:
- If a tile provider can not service a zoom level (because of min/max zoom
level of tile provider or tile source) it might not be called
How my NetworkProvider was supposed to work is that if the current mode is not
OFFLINE and the tileSource us not null, then the respective min and max zoom
levels from the source are returned. Otherwise the Provider will give the
maximum possible zoom level for getMaximumZoomLevel and minimum possible zoom
level for getMinimumZoomLevel, so it will be always used because it can provide
tiles for all the zoom levels, and how it does this is that for offline mode it
generates tiles with an offline icon on them to let the user know that he can't
see them because of his network state.
The screw-up was in the getMinZoomLevel and getMaxZoomLevel methods, as they
returned the exact opposite of what they were supposed to return, in the case
the app is offline (Min returned the max value and Max returned the min value,
so it was never used for offline cases).
Why this worked before I have no idea, but I'm new on the project that I'm
working on, which has an extensive preexisting code base, so I'm still getting
the hang of things finding my way around.
I hope this helps anyone who might have a similar issue somewhere down the line.
Once again, thank you for the quick responses and for the useful pointers :)
Original comment by matej.di...@gmail.com
on 14 May 2013 at 2:19
Good to hear! The behavior where tile modules are skipped if they can not
service a zoom level is a relatively new change (3.0.9?) so it probably didn't
manifest itself in the past. It is an optimization - if a tile module can not
service a zoom level, then there is no reason to call it. This is particularly
useful for TileDownloaders so they don't bother putting network traffic out
there that will only result in a 404.
It sounds like this issue can be closed.
Original comment by kurtzm...@gmail.com
on 15 May 2013 at 1:11
Original issue reported on code.google.com by
matej.di...@gmail.com
on 14 May 2013 at 12:06