title: OSMDroid - Map does not display
body: <p>I am trying to load open street maps on my app.</p>
  
  <p>My code is the following:</p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  
  import org.osmdroid.config.Configuration;
  import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
  import org.osmdroid.views.MapView;
  import org.osmdroid.util.GeoPoint;
  import org.osmdroid.views.MapController;
  
  
  public class OsmActivity extends Activity {
  private MapView         mMapView;
  private MapController   mMapController;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_osm);
  
  
      Configuration.getInstance().setUserAgentValue(getPackageName());
  
      mMapView = (MapView) findViewById(R.id.map);
      mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
      mMapView.setBuiltInZoomControls(true);
      mMapController = (MapController) mMapView.getController();
      mMapController.setZoom(13);
      GeoPoint gPt = new GeoPoint(51500000, -150000);
      mMapController.setCenter(gPt);
  }
  }
  </code></pre>
  
  <p>I am using osmdroid 5.6.5 (via Maven).</p>
  
  <p>I define my user agent according to the osmdroid doc.</p>
  
  <pre><code>Configuration.getInstance().setUserAgentValue(getPackageName());
  </code></pre>
  
  <p>I have these API settings:</p>
  
  <pre><code>android {
  compileSdkVersion 26
  defaultConfig {
      applicationId "com.loco_zero.locolizetestsosm"
      minSdkVersion 21
      targetSdkVersion 26
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  }
  </code></pre>
  
  <p>With these permissions:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"  /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>I have the grid and the zoom buttons, but the map won't show.
  I get these errors:</p>
  
  <pre><code>I/StorageUtils: /sdcard is NOT writable
  I/StorageUtils: /storage/emulated/0 is NOT writable
  I/OsmDroid: Using tile source: Mapnik
  E/SQLiteLog: (14) cannot open file at line 31278 of [2ef4f3a5b1]
  E/SQLiteLog: (14) os_unix.c:31278: (13) open(/storage/emulated/0/osmdroid/tiles/cache.db) - 
  E/SQLiteDatabase: Failed to open database '/storage/emulated/0/osmdroid/tiles/cache.db'.
                android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
  
  D/OsmDroid: Unable to store cached tile from Mapnik /13/4090/2719, database not available.
  </code></pre>
  
  <p>What am I doing wrong?
  Can I tell OSMDroid to use something other than the sdcard folder?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I added the following to get the permissions at runtime, it did the trick:</p>
  
  <pre><code>    if (Build.VERSION.SDK_INT &gt;= 23) {
          if (checkSelfPermission(android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
              Log.v(TAG, "Permission is granted");
          } else {
              Log.v(TAG, "Permission is revoked");
              ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
          }
      }
  </code></pre>