Map does not appear when using osmdroid

I was following this simple tutorial about using osmdroid: http://www.gleisarbeiter.de/2011/03/17/using-openstreetmaps-with-osmdroid-on-android/

but whenever I run the application, using the Genymotion android emulator, or a real device, I just see grey titles rather than a map, as can be seen here:

My androidmanifest.xml file is:

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.picofoundry.nationalparksofjapan"
     android:versionCode="1"
     android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <uses-feature android:name="android.hardware.location.network" />
    <uses-feature android:name="android.hardware.location.gps" />
    <uses-feature android:name="android.hardware.wifi" />


    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <!-- Splash screen -->
    <activity
        android:name="com.picofoundry.nationalparksofjapan.SplashScreen"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- Main activity -->
    <activity
        android:name="com.picofoundry.nationalparksofjapan.MainActivity"
        android:launchMode="singleTask"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name" >
    </activity>
</application>
</manifest>

and MainActivity is:

package com.picofoundry.nationalparksofjapan;

import android.os.Bundle;
import android.app.Activity;

import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;

public class MainActivity extends Activity {

private MapView myOpenMapView;
private MapController myMapController;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    myOpenMapView = new MapView(this, 256);
    myOpenMapView.setClickable(true);
    myOpenMapView.setBuiltInZoomControls(true);
    setContentView(myOpenMapView);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
}

Answers


If you are using the default tile provider (Mapnik), then they very recently stopped providing tiles because of an incorrect user agent field in the request. Osmdroid version 4.1 fixes the problem.


Need Your Help

How to escape % in roxygen literate programming?

r literate-programming roxygen

The default value of a parameter of my function contains a "%". This seems to be a problem for roxygen, it produces a lot of warnings and R CMD check fails when trying to build latex documentation....