docs: @Override
      public void load(Context ctx, SharedPreferences prefs) {
          mNormalizedUserAgent = computeNormalizedUserAgent(ctx);
  
          //cache management starts here
  
          //check to see if the shared preferences is set for the tile cache
          if (!prefs.contains("osmdroid.basePath")) {
              //this is the first time startup. run the discovery bit
              File discoveredBasePath = getOsmdroidBasePath();
              File discoveredCachePath = getOsmdroidTileCache();
              if (!discoveredBasePath.exists() || !StorageUtils.isWritable(discoveredBasePath)) {
                  //this should always be writable...
                  discoveredBasePath = new File(ctx.getFilesDir(), "osmdroid");
                  discoveredCachePath = new File(discoveredBasePath, "tiles");
                  discoveredCachePath.mkdirs();
              }
  
              SharedPreferences.Editor edit = prefs.edit();
              edit.putString("osmdroid.basePath",discoveredBasePath.getAbsolutePath());
              edit.putString("osmdroid.cachePath",discoveredCachePath.getAbsolutePath());
              commit(edit);
              setOsmdroidBasePath(discoveredBasePath);
              setOsmdroidTileCache(discoveredCachePath);
              setUserAgentValue(ctx.getPackageName());
              save(ctx,prefs);
          } else {
              //normal startup, load user preferences and populate the config object
              setOsmdroidBasePath(new File(prefs.getString("osmdroid.basePath", getOsmdroidBasePath().getAbsolutePath())));
              setOsmdroidTileCache(new File(prefs.getString("osmdroid.cachePath", getOsmdroidTileCache().getAbsolutePath())));
              setDebugMode(prefs.getBoolean("osmdroid.DebugMode", debugMode));
              setDebugMapTileDownloader(prefs.getBoolean("osmdroid.DebugDownloading", debugMapTileDownloader));
              setDebugMapView(prefs.getBoolean("osmdroid.DebugMapView", debugMapView));
              setDebugTileProviders(prefs.getBoolean("osmdroid.DebugTileProvider", debugTileProviders));
              setMapViewHardwareAccelerated(prefs.getBoolean("osmdroid.HardwareAcceleration", isMapViewHardwareAccelerated));
              setUserAgentValue(prefs.getString("osmdroid.userAgentValue", ctx.getPackageName()));
              load(prefs, mAdditionalHttpRequestProperties, "osmdroid.additionalHttpRequestProperty.");
              setGpsWaitTime(prefs.getLong("osmdroid.gpsWaitTime", gpsWaitTime));
              setTileDownloadThreads((short)(prefs.getInt("osmdroid.tileDownloadThreads", tileDownloadThreads)));
              setTileFileSystemThreads((short)(prefs.getInt("osmdroid.tileFileSystemThreads", tileFileSystemThreads)));
              setTileDownloadMaxQueueSize((short)(prefs.getInt("osmdroid.tileDownloadMaxQueueSize", tileDownloadMaxQueueSize)));
              setTileFileSystemMaxQueueSize((short)(prefs.getInt("osmdroid.tileFileSystemMaxQueueSize", tileFileSystemMaxQueueSize)));
              setExpirationExtendedDuration((long)prefs.getLong("osmdroid.ExpirationExtendedDuration", expirationAdder));
              setMapViewRecyclerFriendly((boolean)prefs.getBoolean("osmdroid.mapViewRecycler", mapViewRecycler));
              setAnimationSpeedDefault(prefs.getInt("osmdroid.ZoomSpeedDefault", animationSpeedDefault));
              setAnimationSpeedShort(prefs.getInt("osmdroid.animationSpeedShort", animationSpeedShort));
              setCacheMapTileOvershoot((short)(prefs.getInt("osmdroid.cacheTileOvershoot", cacheTileOvershoot)));
              setMapTileDownloaderFollowRedirects(prefs.getBoolean("osmdroid.TileDownloaderFollowRedirects", mTileDownloaderFollowRedirects));
  
              if (prefs.contains("osmdroid.ExpirationOverride")) {
                  expirationOverride = prefs.getLong("osmdroid.ExpirationOverride",-1);
                  if (expirationOverride!=null && expirationOverride==-1)
                      expirationOverride=null;
              }
  
          }
  
          if (Build.VERSION.SDK_INT >= 9) {
              //unfortunately API 8 doesn't support File.length()
  
              //https://github/osmdroid/osmdroid/issues/435
              //On startup, we auto set the max cache size to be the current cache size + free disk space
              //this reduces the chance of osmdroid completely filling up the storage device
  
              //if the default max cache size is greater than the available free space
              //reduce it to 95% of the available free space + the size of the cache
              long cacheSize = 0;
              File dbFile = new File(getOsmdroidTileCache().getAbsolutePath() + File.separator + SqlTileWriter.DATABASE_FILENAME);
              if (dbFile.exists()) {
                  cacheSize = dbFile.length();
              }
  
              long freeSpace = getOsmdroidTileCache().getFreeSpace();
  
              //Log.i(TAG, "Current cache size is " + cacheSize + " free space is " + freeSpace);
              if (getTileFileSystemCacheMaxBytes() > (freeSpace + cacheSize)){
                  setTileFileSystemCacheMaxBytes((long)((freeSpace + cacheSize) * 0.95));
                  setTileFileSystemCacheTrimBytes((long)((freeSpace + cacheSize) * 0.90));
              }
          }
      }