Skip to content

Display a map

Famoco devices do not have Google Play Services installed by default, therefore it is not possible to use Google Maps to display maps into your apps. As an alternative, we recommend to use OpenStreetMap for Android which provides native support for Android. This page gives a step by step guide to integrate osmdroid library into your app. Full details are available on the official osmdroid Github projet here.

Step 1: Import the osmdroid library

Add the following dependency to your build.gradle file

dependencies {
    implementation 'org.osmdroid:osmdroid-android:(INSERT_VERSION_HERE):release@aar'

Step 2: Set the authorizations

Set the following authorizations in your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_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-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Step 3: Set the layout

Create a src/main/res/layouts/main.xml layout like this one

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
        <org.osmdroid.views.MapView android:id="@+id/map"
                android:layout_height="match_parent" />

Step 4: Main Activity

Now create the main activity (

import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.views.MapView;

public class MainActivity extends AppCompatActivity {
    @Override public void onCreate(Bundle savedInstanceState) {
        Context ctx = getApplicationContext();
        //important! set your user agent to prevent getting banned from the osm servers 
        Configuration.getInstance().load(ctx, PreferenceManager.getDefaultSharedPreferences(ctx));

        MapView map = (MapView) findViewById(;

    public void onResume(){
        //this will refresh the osmdroid configuration on resuming.
        //if you make changes to the configuration, use
        //SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        //Configuration.getInstance().save(this, prefs);
        Configuration.getInstance().load(this, PreferenceManager.getDefaultSharedPreferences(this));

Add default zoom buttons, and ability to zoom with 2 fingers (multi-touch)


Move the map to a default view point. For this, access the map controller:

IMapController mapController = map.getController();
        GeoPoint startPoint = new GeoPoint(48.8583, 2.2944);

Source and sample project can be found at: GitHub