
public class DefaultConfigurationProvider extends Object implements IConfigurationProvider
IConfigurationProvider,
Configuration| Constructor and Description |
|---|
DefaultConfigurationProvider() |
| Modifier and Type | Method and Description |
|---|---|
Map<String,String> |
getAdditionalHttpRequestProperties()
Enables you to set and get additional HTTP request properties.
|
int |
getAnimationSpeedDefault()
Used during zoom animations
https://github.com/osmdroid/osmdroid/issues/650
|
int |
getAnimationSpeedShort()
Used during zoom animations
https://github.com/osmdroid/osmdroid/issues/650
|
short |
getCacheMapTileCount()
Initial tile cache size (in memory).
|
short |
getCacheMapTileOvershoot()
In memory tile count, used by the tiles overlay
|
long |
getExpirationExtendedDuration()
Returns the amount of time in ms added to server specified tile expiration time
Added as part of issue https://github.com/osmdroid/osmdroid/issues/490
|
Long |
getExpirationOverrideDuration()
Optional period of time in ms that will override any downloaded tile's expiration timestamp
|
long |
getGpsWaitTime()
default is 20 seconds
|
SimpleDateFormat |
getHttpHeaderDateTimeFormat() |
Proxy |
getHttpProxy() |
String |
getNormalizedUserAgent() |
File |
getOsmdroidBasePath()
Base path for osmdroid files.
|
File |
getOsmdroidTileCache()
by default, maps to getOsmdroidBasePath() + "/tiles"
By default, it is defined in SD card, osmdroid directory.
|
short |
getTileDownloadMaxQueueSize() |
short |
getTileDownloadThreads()
number of tile download threads, conforming to OSM policy:
http://wiki.openstreetmap.org/wiki/Tile_usage_policy
default is 2
|
long |
getTileFileSystemCacheMaxBytes()
default is 600 Mb
|
long |
getTileFileSystemCacheTrimBytes()
When the cache size exceeds maxCacheSize, tiles will be automatically removed to reach this target.
|
short |
getTileFileSystemMaxQueueSize() |
short |
getTileFileSystemThreads()
used for both file system cache and the sqlite cache
|
long |
getTileGCBulkPauseInMillis()
Pause during tile garbage collection bulk deletions
|
int |
getTileGCBulkSize()
Tile garbage collection bulk size
|
long |
getTileGCFrequencyInMillis()
Delay between tile garbage collection calls
|
String |
getUserAgentHttpHeader()
"User-Agent" is the default value and standard used throughout all http servers, unlikely to change
When calling @link
IConfigurationProvider.load(Context, SharedPreferences), it is set to
Context.getPackageName() which is defined your manifest file |
String |
getUserAgentValue() |
boolean |
isDebugMapTileDownloader() |
boolean |
isDebugMapView()
Typically used to enable additional debugging
|
boolean |
isDebugMode()
Typically used to enable additional debugging
from
OpenStreetMapTileProviderConstants |
boolean |
isDebugTileProviders()
Typically used to enable additional debugging
from
OpenStreetMapTileProviderConstants |
boolean |
isMapTileDownloaderFollowRedirects() |
boolean |
isMapViewHardwareAccelerated()
default is false
|
boolean |
isMapViewRecyclerFriendly()
If true, the map view will set .setHasTransientState(true) for API 16+ devices.
|
void |
load(Context ctx,
SharedPreferences prefs)
loads the configuration from shared preferences, if the preferences defined in this file are not already
set, them they will be populated with defaults.
|
void |
save(Context ctx,
SharedPreferences prefs)
saves the current configuration to the shared preference location
|
void |
setAnimationSpeedDefault(int durationsMilliseconds)
Used during zoom animations
https://github.com/osmdroid/osmdroid/issues/650
|
void |
setAnimationSpeedShort(int durationsMilliseconds)
Used during zoom animations
https://github.com/osmdroid/osmdroid/issues/650
|
void |
setCacheMapTileCount(short cacheMapTileCount)
Initial tile cache size (in memory).
|
void |
setCacheMapTileOvershoot(short value)
In memory tile count, used by the tiles overlay
|
void |
setDebugMapTileDownloader(boolean debugMapTileDownloader) |
void |
setDebugMapView(boolean debugMapView) |
void |
setDebugMode(boolean debugMode) |
void |
setDebugTileProviders(boolean debugTileProviders) |
void |
setExpirationExtendedDuration(long period)
Optionally extends the amount of time that downloaded tiles remain in the cache beyond either the
server specified expiration time stamp or the default expiration time {
OpenStreetMapTileProviderConstants.DEFAULT_MAXIMUM_CACHED_FILE_AGE} |
void |
setExpirationOverrideDuration(Long period)
Optional period of time in ms that will override any downloaded tile's expiration timestamp
|
void |
setGpsWaitTime(long gpsWaitTime)
The time we wait after the last gps location before using a non-gps location.
|
void |
setHttpHeaderDateTimeFormat(SimpleDateFormat httpHeaderDateTimeFormat) |
void |
setHttpProxy(Proxy httpProxy) |
void |
setMapTileDownloaderFollowRedirects(boolean value)
enables/disables tile downloading following redirects.
|
void |
setMapViewHardwareAccelerated(boolean mapViewHardwareAccelerated)
must be set before the mapview is created or inflated from a layout.
|
void |
setMapViewRecyclerFriendly(boolean enabled)
If true, the map view will set .setHasTransientState(true) for API 16+ devices.
|
void |
setOsmdroidBasePath(File osmdroidBasePath)
Base path for osmdroid files.
|
void |
setOsmdroidTileCache(File osmdroidTileCache)
by default, maps to getOsmdroidBasePath() + "/tiles"
Sets the location where the tile cache is stored.
|
void |
setTileDownloadMaxQueueSize(short tileDownloadMaxQueueSize) |
void |
setTileDownloadThreads(short tileDownloadThreads) |
void |
setTileFileSystemCacheMaxBytes(long tileFileSystemCacheMaxBytes) |
void |
setTileFileSystemCacheTrimBytes(long tileFileSystemCacheTrimBytes) |
void |
setTileFileSystemMaxQueueSize(short tileFileSystemMaxQueueSize) |
void |
setTileFileSystemThreads(short tileFileSystemThreads)
used for both file system cache and the sqlite cache
|
void |
setTileGCBulkPauseInMillis(long pMillis) |
void |
setTileGCBulkSize(int pSize) |
void |
setTileGCFrequencyInMillis(long pMillis) |
void |
setUserAgentHttpHeader(String userAgentHttpHeader)
"User-Agent" is the default value and standard used throughout all http servers, unlikely to change
When calling @link
IConfigurationProvider.load(Context, SharedPreferences), it is set to
Context.getPackageName() which is defined your manifest file |
void |
setUserAgentValue(String userAgentValue)
Enables you to override the default "osmdroid" value for HTTP user agents.
|
public static final String DEFAULT_USER_AGENT
protected long gpsWaitTime
protected boolean debugMode
protected boolean debugMapView
protected boolean debugTileProviders
protected boolean debugMapTileDownloader
protected boolean isMapViewHardwareAccelerated
protected String userAgentValue
protected String userAgentHttpHeader
protected short cacheMapTileCount
protected short tileDownloadThreads
protected short tileFileSystemThreads
protected short tileDownloadMaxQueueSize
protected short tileFileSystemMaxQueueSize
protected long tileFileSystemCacheMaxBytes
protected long tileFileSystemCacheTrimBytes
protected SimpleDateFormat httpHeaderDateTimeFormat
protected File osmdroidBasePath
protected File osmdroidTileCache
protected long expirationAdder
protected Long expirationOverride
protected Proxy httpProxy
protected int animationSpeedDefault
protected int animationSpeedShort
protected boolean mapViewRecycler
protected short cacheTileOvershoot
protected long mTileGCFrequencyInMillis
protected int mTileGCBulkSize
protected long mTileGCBulkPauseInMillis
protected boolean mTileDownloaderFollowRedirects
public long getGpsWaitTime()
getGpsWaitTime in interface IConfigurationProviderpublic void setGpsWaitTime(long gpsWaitTime)
IConfigurationProvidersetGpsWaitTime in interface IConfigurationProviderpublic boolean isDebugMode()
IConfigurationProviderOpenStreetMapTileProviderConstantsisDebugMode in interface IConfigurationProviderpublic void setDebugMode(boolean debugMode)
setDebugMode in interface IConfigurationProviderpublic boolean isDebugMapView()
IConfigurationProviderisDebugMapView in interface IConfigurationProviderpublic void setDebugMapView(boolean debugMapView)
setDebugMapView in interface IConfigurationProviderpublic boolean isDebugTileProviders()
IConfigurationProviderOpenStreetMapTileProviderConstantsisDebugTileProviders in interface IConfigurationProviderpublic void setDebugTileProviders(boolean debugTileProviders)
setDebugTileProviders in interface IConfigurationProviderpublic boolean isDebugMapTileDownloader()
isDebugMapTileDownloader in interface IConfigurationProviderpublic void setDebugMapTileDownloader(boolean debugMapTileDownloader)
setDebugMapTileDownloader in interface IConfigurationProviderpublic boolean isMapViewHardwareAccelerated()
IConfigurationProviderisMapViewHardwareAccelerated in interface IConfigurationProviderpublic void setMapViewHardwareAccelerated(boolean mapViewHardwareAccelerated)
IConfigurationProviderdefault is false
setMapViewHardwareAccelerated in interface IConfigurationProviderPolygon,
Polylinepublic String getUserAgentValue()
getUserAgentValue in interface IConfigurationProviderpublic void setUserAgentValue(String userAgentValue)
IConfigurationProvider
You MUST use this to set the user agent to some value specific to your application.
Typical usage: Context.getApplicationContext().getPackageName();
from OpenStreetMapTileProviderConstants
setUserAgentValue in interface IConfigurationProviderpublic Map<String,String> getAdditionalHttpRequestProperties()
IConfigurationProviderA simple use case would be: Configuration.getInstance().getAdditionalHttpRequestProperties().put("Origin", "http://www.example-social-network.com");
See https://github.com/osmdroid/osmdroid/issues/570
getAdditionalHttpRequestProperties in interface IConfigurationProviderpublic short getCacheMapTileCount()
IConfigurationProviderMapTileCache.ensureCapacity(int) The tile cache will always be at least 3x3.
from OpenStreetMapTileProviderConstants
used by MapTileCachegetCacheMapTileCount in interface IConfigurationProviderMapTileCachepublic void setCacheMapTileCount(short cacheMapTileCount)
IConfigurationProviderMapTileCache.ensureCapacity(int) The tile cache will always be at least 3x3.
from OpenStreetMapTileProviderConstants
used by MapTileCachesetCacheMapTileCount in interface IConfigurationProviderMapTileCachepublic short getTileDownloadThreads()
IConfigurationProvidergetTileDownloadThreads in interface IConfigurationProviderpublic void setTileDownloadThreads(short tileDownloadThreads)
setTileDownloadThreads in interface IConfigurationProviderpublic short getTileFileSystemThreads()
IConfigurationProvidergetTileFileSystemThreads in interface IConfigurationProviderpublic void setTileFileSystemThreads(short tileFileSystemThreads)
IConfigurationProvidersetTileFileSystemThreads in interface IConfigurationProviderpublic short getTileDownloadMaxQueueSize()
getTileDownloadMaxQueueSize in interface IConfigurationProviderpublic void setTileDownloadMaxQueueSize(short tileDownloadMaxQueueSize)
setTileDownloadMaxQueueSize in interface IConfigurationProviderpublic short getTileFileSystemMaxQueueSize()
getTileFileSystemMaxQueueSize in interface IConfigurationProviderpublic void setTileFileSystemMaxQueueSize(short tileFileSystemMaxQueueSize)
setTileFileSystemMaxQueueSize in interface IConfigurationProviderpublic long getTileFileSystemCacheMaxBytes()
IConfigurationProvidergetTileFileSystemCacheMaxBytes in interface IConfigurationProviderpublic void setTileFileSystemCacheMaxBytes(long tileFileSystemCacheMaxBytes)
setTileFileSystemCacheMaxBytes in interface IConfigurationProviderpublic long getTileFileSystemCacheTrimBytes()
IConfigurationProvidergetTileFileSystemCacheTrimBytes in interface IConfigurationProviderpublic void setTileFileSystemCacheTrimBytes(long tileFileSystemCacheTrimBytes)
setTileFileSystemCacheTrimBytes in interface IConfigurationProviderpublic SimpleDateFormat getHttpHeaderDateTimeFormat()
getHttpHeaderDateTimeFormat in interface IConfigurationProviderpublic void setHttpHeaderDateTimeFormat(SimpleDateFormat httpHeaderDateTimeFormat)
setHttpHeaderDateTimeFormat in interface IConfigurationProviderpublic Proxy getHttpProxy()
getHttpProxy in interface IConfigurationProviderpublic void setHttpProxy(Proxy httpProxy)
setHttpProxy in interface IConfigurationProviderpublic File getOsmdroidBasePath()
IConfigurationProvidergetOsmdroidBasePath in interface IConfigurationProviderpublic void setOsmdroidBasePath(File osmdroidBasePath)
IConfigurationProviderDefault is StorageUtils.getStorage().getAbsolutePath(),"osmdroid", which usually maps to /sdcard/osmdroid
setOsmdroidBasePath in interface IConfigurationProviderpublic File getOsmdroidTileCache()
IConfigurationProviderMapView}
is created. Changes made after it's creation (either pogrammatic or via layout inflator) have
no effect until the map is restarted or the MapView.setTileProvider(MapTileProviderBase)
is changed or recreated.
Note: basePath and tileCache directories can be changed independently This has no effect on offline archives and can be changed independently
getOsmdroidTileCache in interface IConfigurationProviderpublic void setOsmdroidTileCache(File osmdroidTileCache)
IConfigurationProviderMapView}
is created. Changes made after it's creation (either pogrammatic or via layout inflator) have
no effect until the map is restarted or the MapView.setTileProvider(MapTileProviderBase)
is changed or recreated.
This has no effect on offline archives and can be changed independently
setOsmdroidTileCache in interface IConfigurationProviderpublic String getUserAgentHttpHeader()
IConfigurationProviderIConfigurationProvider.load(Context, SharedPreferences), it is set to
Context.getPackageName() which is defined your manifest file
made adjustable just in case
from OpenStreetMapTileProviderConstants
getUserAgentHttpHeader in interface IConfigurationProviderpublic void setUserAgentHttpHeader(String userAgentHttpHeader)
IConfigurationProviderIConfigurationProvider.load(Context, SharedPreferences), it is set to
Context.getPackageName() which is defined your manifest file
made adjustable just in case
from OpenStreetMapTileProviderConstants
setUserAgentHttpHeader in interface IConfigurationProviderpublic void load(Context ctx, SharedPreferences prefs)
IConfigurationProviderload in interface IConfigurationProviderpublic void save(Context ctx, SharedPreferences prefs)
IConfigurationProvidersave in interface IConfigurationProviderpublic long getExpirationExtendedDuration()
IConfigurationProvidergetExpirationExtendedDuration in interface IConfigurationProviderpublic void setExpirationExtendedDuration(long period)
IConfigurationProviderOpenStreetMapTileProviderConstants.DEFAULT_MAXIMUM_CACHED_FILE_AGE}
Note: this setting only controls tiles as they are downloaded. tiles already in the cache are not effected by this setting Added as part of issue https://github.com/osmdroid/osmdroid/issues/490
setExpirationExtendedDuration in interface IConfigurationProviderperiod - time in ms, if 0, no additional time to the 'server provided expiration' or the
'default expiration time' is added. If the value is less than 0, 0 will be usedpublic void setExpirationOverrideDuration(Long period)
IConfigurationProvidersetExpirationOverrideDuration in interface IConfigurationProviderperiod - if null, this setting is unset, server value + getExpirationExtendedDuration apply
if not null, this this value is usedpublic Long getExpirationOverrideDuration()
IConfigurationProvidergetExpirationOverrideDuration in interface IConfigurationProviderpublic void setAnimationSpeedDefault(int durationsMilliseconds)
IConfigurationProvidersetAnimationSpeedDefault in interface IConfigurationProviderpublic int getAnimationSpeedDefault()
IConfigurationProvidergetAnimationSpeedDefault in interface IConfigurationProviderpublic void setAnimationSpeedShort(int durationsMilliseconds)
IConfigurationProvidersetAnimationSpeedShort in interface IConfigurationProviderpublic int getAnimationSpeedShort()
IConfigurationProvidergetAnimationSpeedShort in interface IConfigurationProviderpublic boolean isMapViewRecyclerFriendly()
IConfigurationProviderisMapViewRecyclerFriendly in interface IConfigurationProviderpublic void setMapViewRecyclerFriendly(boolean enabled)
IConfigurationProvidersetMapViewRecyclerFriendly in interface IConfigurationProviderpublic void setCacheMapTileOvershoot(short value)
IConfigurationProvidersetCacheMapTileOvershoot in interface IConfigurationProviderTilesOverlaypublic short getCacheMapTileOvershoot()
IConfigurationProvidergetCacheMapTileOvershoot in interface IConfigurationProviderpublic long getTileGCFrequencyInMillis()
IConfigurationProvidergetTileGCFrequencyInMillis in interface IConfigurationProviderpublic void setTileGCFrequencyInMillis(long pMillis)
setTileGCFrequencyInMillis in interface IConfigurationProviderpublic int getTileGCBulkSize()
IConfigurationProvidergetTileGCBulkSize in interface IConfigurationProviderpublic void setTileGCBulkSize(int pSize)
setTileGCBulkSize in interface IConfigurationProviderpublic long getTileGCBulkPauseInMillis()
IConfigurationProvidergetTileGCBulkPauseInMillis in interface IConfigurationProviderpublic void setTileGCBulkPauseInMillis(long pMillis)
setTileGCBulkPauseInMillis in interface IConfigurationProviderpublic void setMapTileDownloaderFollowRedirects(boolean value)
IConfigurationProvidersetMapTileDownloaderFollowRedirects in interface IConfigurationProviderpublic boolean isMapTileDownloaderFollowRedirects()
isMapTileDownloaderFollowRedirects in interface IConfigurationProviderpublic String getNormalizedUserAgent()
getNormalizedUserAgent in interface IConfigurationProvider