-
public interface IConfigurationProviderSingleton class to get/set a configuration provider for osmdroid Issue 481Created on 11/29/2016.
-
-
Method Summary
Modifier and Type Method Description abstract longgetGpsWaitTime()The time we wait after the last gps location before using a non-gps location.was previously at org.osmdroid.util.constants. abstract voidsetGpsWaitTime(long gpsWaitTime)The time we wait after the last gps location before using a non-gps location. abstract booleanisDebugMode()Typically used to enable additional debuggingfrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants abstract voidsetDebugMode(boolean debugMode)abstract booleanisDebugMapView()Typically used to enable additional debugging abstract voidsetDebugMapView(boolean debugMapView)abstract booleanisDebugTileProviders()Typically used to enable additional debuggingfrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants abstract voidsetDebugTileProviders(boolean debugTileProviders)abstract booleanisDebugMapTileDownloader()abstract voidsetDebugMapTileDownloader(boolean debugMapTileDownloader)abstract booleanisMapViewHardwareAccelerated()default is false abstract voidsetMapViewHardwareAccelerated(boolean mapViewHardwareAccelerated)must be set before the mapview is created or inflated from a layout.If you're only using single point icons, then you can probably get away with setting this to trueotherwise (using polylines, paths, polygons) set it to false. abstract StringgetUserAgentValue()abstract voidsetUserAgentValue(String userAgentValue)Enables you to override the default "osmdroid" value for HTTP user agents. abstract Map<String, String>getAdditionalHttpRequestProperties()Enables you to set and get additional HTTP request properties. abstract shortgetCacheMapTileCount()Initial tile cache size (in memory). abstract voidsetCacheMapTileCount(short cacheMapTileCount)Initial tile cache size (in memory). abstract shortgetTileDownloadThreads()number of tile download threads, conforming to OSM policy:http://wiki.openstreetmap. abstract voidsetTileDownloadThreads(short tileDownloadThreads)abstract shortgetTileFileSystemThreads()used for both file system cache and the sqlite cache abstract voidsetTileFileSystemThreads(short tileFileSystemThreads)used for both file system cache and the sqlite cache abstract shortgetTileDownloadMaxQueueSize()abstract voidsetTileDownloadMaxQueueSize(short tileDownloadMaxQueueSize)abstract shortgetTileFileSystemMaxQueueSize()abstract voidsetTileFileSystemMaxQueueSize(short tileFileSystemMaxQueueSize)abstract longgetTileFileSystemCacheMaxBytes()default is 600 Mb abstract voidsetTileFileSystemCacheMaxBytes(long tileFileSystemCacheMaxBytes)abstract longgetTileFileSystemCacheTrimBytes()When the cache size exceeds maxCacheSize, tiles will be automatically removed to reach this target. abstract voidsetTileFileSystemCacheTrimBytes(long tileFileSystemCacheTrimBytes)abstract SimpleDateFormatgetHttpHeaderDateTimeFormat()abstract voidsetHttpHeaderDateTimeFormat(SimpleDateFormat httpHeaderDateTimeFormat)abstract ProxygetHttpProxy()abstract voidsetHttpProxy(Proxy httpProxy)abstract FilegetOsmdroidBasePath()Base path for osmdroid files. abstract FilegetOsmdroidBasePath(Context context)Base path for osmdroid files. abstract voidsetOsmdroidBasePath(File osmdroidBasePath)Base path for osmdroid files. abstract FilegetOsmdroidTileCache()by default, maps to getOsmdroidBasePath() + "/tiles"By default, it is defined in SD card, osmdroid directory.Sets the location where the tile cache is stored. abstract FilegetOsmdroidTileCache(Context context)by default, maps to getOsmdroidBasePath() + "/tiles"By default, it is defined in SD card, osmdroid directory.Sets the location where the tile cache is stored. abstract voidsetOsmdroidTileCache(File osmdroidTileCache)by default, maps to getOsmdroidBasePath() + "/tiles"Sets the location where the tile cache is stored. abstract StringgetUserAgentHttpHeader()"User-Agent" is the default value and standard used throughout all http servers, unlikely to changeWhen calling @link load, it is set to getPackageName which is defined your manifest filemade adjustable just in casefrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants abstract voidsetUserAgentHttpHeader(String userAgentHttpHeader)"User-Agent" is the default value and standard used throughout all http servers, unlikely to changeWhen calling @link load, it is set to getPackageName which is defined your manifest filemade adjustable just in casefrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants abstract voidload(Context ctx, SharedPreferences preferences)loads the configuration from shared preferences, if the preferences defined in this file are not alreadyset, them they will be populated with defaults. abstract voidsave(Context ctx, SharedPreferences preferences)saves the current configuration to the shared preference location abstract longgetExpirationExtendedDuration()Returns the amount of time in ms added to server specified tile expiration timeAdded as part of issue https://github. abstract voidsetExpirationExtendedDuration(long period)Optionally extends the amount of time that downloaded tiles remain in the cache beyond either theserver specified expiration time stamp or the default expiration time {DEFAULT_MAXIMUM_CACHED_FILE_AGE}Note: this setting only controls tiles as they are downloaded. abstract voidsetExpirationOverrideDuration(Long period)Optional period of time in ms that will override any downloaded tile's expiration timestamp abstract LonggetExpirationOverrideDuration()Optional period of time in ms that will override any downloaded tile's expiration timestamp abstract voidsetAnimationSpeedDefault(int durationsMilliseconds)Used during zoom animationshttps://github. abstract intgetAnimationSpeedDefault()Used during zoom animationshttps://github. abstract voidsetAnimationSpeedShort(int durationsMilliseconds)Used during zoom animationshttps://github. abstract intgetAnimationSpeedShort()Used during zoom animationshttps://github. abstract booleanisMapViewRecyclerFriendly()If true, the map view will set .setHasTransientState(true) for API 16+ devices.This is now the default setting. abstract voidsetMapViewRecyclerFriendly(boolean enabled)If true, the map view will set .setHasTransientState(true) for API 16+ devices.This is now the default setting. abstract voidsetCacheMapTileOvershoot(short value)In memory tile count, used by the tiles overlay abstract shortgetCacheMapTileOvershoot()In memory tile count, used by the tiles overlay abstract longgetTileGCFrequencyInMillis()Delay between tile garbage collection calls abstract voidsetTileGCFrequencyInMillis(long pMillis)abstract intgetTileGCBulkSize()Tile garbage collection bulk size abstract voidsetTileGCBulkSize(int pSize)abstract longgetTileGCBulkPauseInMillis()Pause during tile garbage collection bulk deletions abstract voidsetTileGCBulkPauseInMillis(long pMillis)abstract voidsetMapTileDownloaderFollowRedirects(boolean value)enables/disables tile downloading following redirects. abstract booleanisMapTileDownloaderFollowRedirects()abstract StringgetNormalizedUserAgent()abstract booleanisEnforceTileSystemBounds()Default is false for the DefaultConfigurationProviderIf true and a bounding box is beyond that of the org.osmdroid.util.TileSystem,then an exception is thrown by checks in org.osmdroid.util.BoundingBoxIf false, then no exception is thrown. abstract voidsetEnforceTileSystemBounds(boolean mValue)See isEnforceTileSystemBounds. -
-
Method Detail
-
getGpsWaitTime
abstract long getGpsWaitTime()
The time we wait after the last gps location before using a non-gps location.was previously at org.osmdroid.util.constants.UtilConstants
-
setGpsWaitTime
abstract void setGpsWaitTime(long gpsWaitTime)
The time we wait after the last gps location before using a non-gps location.
-
isDebugMode
abstract boolean isDebugMode()
Typically used to enable additional debuggingfrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
-
setDebugMode
abstract void setDebugMode(boolean debugMode)
-
isDebugMapView
abstract boolean isDebugMapView()
Typically used to enable additional debugging
-
setDebugMapView
abstract void setDebugMapView(boolean debugMapView)
-
isDebugTileProviders
abstract boolean isDebugTileProviders()
Typically used to enable additional debuggingfrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
-
setDebugTileProviders
abstract void setDebugTileProviders(boolean debugTileProviders)
-
isDebugMapTileDownloader
abstract boolean isDebugMapTileDownloader()
-
setDebugMapTileDownloader
abstract void setDebugMapTileDownloader(boolean debugMapTileDownloader)
-
isMapViewHardwareAccelerated
abstract boolean isMapViewHardwareAccelerated()
default is false
-
setMapViewHardwareAccelerated
abstract void setMapViewHardwareAccelerated(boolean mapViewHardwareAccelerated)
must be set before the mapview is created or inflated from a layout.If you're only using single point icons, then you can probably get away with setting this to trueotherwise (using polylines, paths, polygons) set it to false.
default is false
-
getUserAgentValue
abstract String getUserAgentValue()
-
setUserAgentValue
abstract void setUserAgentValue(String userAgentValue)
Enables you to override the default "osmdroid" value for HTTP user agents. Used when downloading tiles
You MUST use this to set the user agent to some value specific to your application.Typical usage: Context.getApplicationContext().getPackageName();from org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
-
getAdditionalHttpRequestProperties
abstract Map<String, String> getAdditionalHttpRequestProperties()
Enables you to set and get additional HTTP request properties. Used when downloading tiles.Mustn't be null, but will be empty in most cases.
A simple use case would be:Configuration.getInstance().getAdditionalHttpRequestProperties().put("Origin", "http://www.example-social-network.com");
See https://github.com/osmdroid/osmdroid/issues/570
-
getCacheMapTileCount
abstract short getCacheMapTileCount()
Initial tile cache size (in memory). The size will be increased as required by calling ensureCapacity The tile cache will always be at least 3x3.from org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants used by MapTileCache
-
setCacheMapTileCount
abstract void setCacheMapTileCount(short cacheMapTileCount)
Initial tile cache size (in memory). The size will be increased as required by calling ensureCapacity The tile cache will always be at least 3x3.from org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants used by MapTileCache
-
getTileDownloadThreads
abstract short getTileDownloadThreads()
number of tile download threads, conforming to OSM policy:http://wiki.openstreetmap.org/wiki/Tile_usage_policydefault is 2
-
setTileDownloadThreads
abstract void setTileDownloadThreads(short tileDownloadThreads)
-
getTileFileSystemThreads
abstract short getTileFileSystemThreads()
used for both file system cache and the sqlite cache
-
setTileFileSystemThreads
abstract void setTileFileSystemThreads(short tileFileSystemThreads)
used for both file system cache and the sqlite cache
-
getTileDownloadMaxQueueSize
abstract short getTileDownloadMaxQueueSize()
-
setTileDownloadMaxQueueSize
abstract void setTileDownloadMaxQueueSize(short tileDownloadMaxQueueSize)
-
getTileFileSystemMaxQueueSize
abstract short getTileFileSystemMaxQueueSize()
-
setTileFileSystemMaxQueueSize
abstract void setTileFileSystemMaxQueueSize(short tileFileSystemMaxQueueSize)
-
getTileFileSystemCacheMaxBytes
abstract long getTileFileSystemCacheMaxBytes()
default is 600 Mb
-
setTileFileSystemCacheMaxBytes
abstract void setTileFileSystemCacheMaxBytes(long tileFileSystemCacheMaxBytes)
-
getTileFileSystemCacheTrimBytes
abstract long getTileFileSystemCacheTrimBytes()
When the cache size exceeds maxCacheSize, tiles will be automatically removed to reach this target. In bytes. Default is 500 Mb.
-
setTileFileSystemCacheTrimBytes
abstract void setTileFileSystemCacheTrimBytes(long tileFileSystemCacheTrimBytes)
-
getHttpHeaderDateTimeFormat
abstract SimpleDateFormat getHttpHeaderDateTimeFormat()
-
setHttpHeaderDateTimeFormat
abstract void setHttpHeaderDateTimeFormat(SimpleDateFormat httpHeaderDateTimeFormat)
-
getHttpProxy
abstract Proxy getHttpProxy()
-
setHttpProxy
abstract void setHttpProxy(Proxy httpProxy)
-
getOsmdroidBasePath
abstract File getOsmdroidBasePath()
Base path for osmdroid files. Zip/sqlite/mbtiles/etc files are in this folder.Note: also used for offline tile sources
If no directory has been set before with setOsmdroidBasePath it triesto automatically detect one. On API>29 and for better results use getOsmdroidBasePath
-
getOsmdroidBasePath
abstract File getOsmdroidBasePath(Context context)
Base path for osmdroid files. Zip/sqlite/mbtiles/etc files are in this folder.Note: also used for offline tile sources
If no directory has been set before with setOsmdroidBasePath it triesto automatically detect one. Passing a context gives better results than getOsmdroidBasePath and is required to find any location on API29.
-
setOsmdroidBasePath
abstract void setOsmdroidBasePath(File osmdroidBasePath)
Base path for osmdroid files. Zip/sqlite/mbtiles/etc files are in this folder.Note: also used for offline tile sources
Default isStorageUtils.getStorage().getAbsolutePath(),"osmdroid", which usually maps to /sdcard/osmdroid
-
getOsmdroidTileCache
abstract File getOsmdroidTileCache()
by default, maps to getOsmdroidBasePath() + "/tiles"By default, it is defined in SD card, osmdroid directory.Sets the location where the tile cache is stored. Changes are only in effect when the { } is created. Changes made after it's creation (either pogrammatic or via layout inflator) haveno effect until the map is restarted or the setTileProvider is changed or recreated.
Note: basePath and tileCache directories can be changed independentlyThis has no effect on offline archives and can be changed independently
If no directory has been set before with setOsmdroidTileCache it triesto automatically detect one. On API>29 and for better results use getOsmdroidTileCache
-
getOsmdroidTileCache
abstract File getOsmdroidTileCache(Context context)
by default, maps to getOsmdroidBasePath() + "/tiles"By default, it is defined in SD card, osmdroid directory.Sets the location where the tile cache is stored. Changes are only in effect when the org.osmdroid.views.MapView}is created. Changes made after it's creation (either pogrammatic or via layout inflator) haveno effect until the map is restarted or the setTileProvider is changed or recreated.
Note: basePath and tileCache directories can be changed independentlyThis has no effect on offline archives and can be changed independently
If no directory has been set before with setOsmdroidTileCache it triesto automatically detect one. Passing a context gives better results than getOsmdroidTileCache and is required to find any location on API29.
-
setOsmdroidTileCache
abstract void setOsmdroidTileCache(File osmdroidTileCache)
by default, maps to getOsmdroidBasePath() + "/tiles"Sets the location where the tile cache is stored. Changes are only in effect when the @{link org.osmdroid.views.MapView}is created. Changes made after it's creation (either pogrammatic or via layout inflator) haveno effect until the map is restarted or the setTileProvider is changed or recreated.
This has no effect on offline archives and can be changed independently
-
getUserAgentHttpHeader
abstract String getUserAgentHttpHeader()
"User-Agent" is the default value and standard used throughout all http servers, unlikely to changeWhen calling @link load, it is set to getPackageName which is defined your manifest file
made adjustable just in casefrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
-
setUserAgentHttpHeader
abstract void setUserAgentHttpHeader(String userAgentHttpHeader)
"User-Agent" is the default value and standard used throughout all http servers, unlikely to changeWhen calling @link load, it is set to getPackageName which is defined your manifest file
made adjustable just in casefrom org.osmdroid.tileprovider.constants.OpenStreetMapTileProviderConstants
-
load
abstract void load(Context ctx, SharedPreferences preferences)
loads the configuration from shared preferences, if the preferences defined in this file are not alreadyset, them they will be populated with defaults. This also initializes the tile storage cache tothe largested writable storage partition available.
-
save
abstract void save(Context ctx, SharedPreferences preferences)
saves the current configuration to the shared preference location
-
getExpirationExtendedDuration
abstract long getExpirationExtendedDuration()
Returns the amount of time in ms added to server specified tile expiration timeAdded as part of issue https://github.com/osmdroid/osmdroid/issues/490
-
setExpirationExtendedDuration
abstract void setExpirationExtendedDuration(long period)
Optionally extends the amount of time that downloaded tiles remain in the cache beyond either theserver specified expiration time stamp or the default expiration time {DEFAULT_MAXIMUM_CACHED_FILE_AGE}
Note: this setting only controls tiles as they are downloaded. tiles already in the cache arenot effected by this settingAdded as part of issue https://github.com/osmdroid/osmdroid/issues/490
- Parameters:
period- time in ms, if 0, no additional time to the 'server provided expiration' or the'default expiration time' is added.
-
setExpirationOverrideDuration
abstract void setExpirationOverrideDuration(Long period)
Optional period of time in ms that will override any downloaded tile's expiration timestamp
- Parameters:
period- if null, this setting is unset, server value + getExpirationExtendedDuration applyif not null, this this value is used
-
getExpirationOverrideDuration
abstract Long getExpirationOverrideDuration()
Optional period of time in ms that will override any downloaded tile's expiration timestamp
-
setAnimationSpeedDefault
abstract void setAnimationSpeedDefault(int durationsMilliseconds)
Used during zoom animationshttps://github.com/osmdroid/osmdroid/issues/650
-
getAnimationSpeedDefault
abstract int getAnimationSpeedDefault()
Used during zoom animationshttps://github.com/osmdroid/osmdroid/issues/650
-
setAnimationSpeedShort
abstract void setAnimationSpeedShort(int durationsMilliseconds)
Used during zoom animationshttps://github.com/osmdroid/osmdroid/issues/650
-
getAnimationSpeedShort
abstract int getAnimationSpeedShort()
Used during zoom animationshttps://github.com/osmdroid/osmdroid/issues/650
-
isMapViewRecyclerFriendly
abstract boolean isMapViewRecyclerFriendly()
If true, the map view will set .setHasTransientState(true) for API 16+ devices.This is now the default setting. Set to false if this is causing you issues
-
setMapViewRecyclerFriendly
abstract void setMapViewRecyclerFriendly(boolean enabled)
If true, the map view will set .setHasTransientState(true) for API 16+ devices.This is now the default setting. Set to false if this is causing you issues
-
setCacheMapTileOvershoot
abstract void setCacheMapTileOvershoot(short value)
In memory tile count, used by the tiles overlay
-
getCacheMapTileOvershoot
abstract short getCacheMapTileOvershoot()
In memory tile count, used by the tiles overlay
-
getTileGCFrequencyInMillis
abstract long getTileGCFrequencyInMillis()
Delay between tile garbage collection calls
-
setTileGCFrequencyInMillis
abstract void setTileGCFrequencyInMillis(long pMillis)
-
getTileGCBulkSize
abstract int getTileGCBulkSize()
Tile garbage collection bulk size
-
setTileGCBulkSize
abstract void setTileGCBulkSize(int pSize)
-
getTileGCBulkPauseInMillis
abstract long getTileGCBulkPauseInMillis()
Pause during tile garbage collection bulk deletions
-
setTileGCBulkPauseInMillis
abstract void setTileGCBulkPauseInMillis(long pMillis)
-
setMapTileDownloaderFollowRedirects
abstract void setMapTileDownloaderFollowRedirects(boolean value)
enables/disables tile downloading following redirects. default is true
-
isMapTileDownloaderFollowRedirects
abstract boolean isMapTileDownloaderFollowRedirects()
-
getNormalizedUserAgent
abstract String getNormalizedUserAgent()
-
isEnforceTileSystemBounds
abstract boolean isEnforceTileSystemBounds()
Default is false for the DefaultConfigurationProviderIf true and a bounding box is beyond that of the org.osmdroid.util.TileSystem,then an exception is thrown by checks in org.osmdroid.util.BoundingBoxIf false, then no exception is thrown.Historical note. Prior to late Feb 2018, which could have been around v6.0.2,the behavior was to NOT throw an exception, Starting with 6.0.2, it starting throwing.This caused a number of issues when importing content from other sources.July 2022, this method was added to help reduce the pain associated with this withthe default set to false (do not throw).Keep in mind, that coordinates beyond that of the tile system may render inaccurately orhave strange behavior.
-
setEnforceTileSystemBounds
abstract void setEnforceTileSystemBounds(boolean mValue)
-
-
-
-