Alternatives to Google Maps

Asked

Viewed 363 times

4

I recently learned that for applications that track users (e.g., taxi apps), Google maps charges an annual license to use its API.

I would like to know if there are other map API alternatives for Android?

2 answers

6


The Open Street Map is the most famous and free alternative. If you googlar open street map android will fall on their Wiki, and there you will find more links to libraries that you can use.

3

To use the Openstreetmap you can download the https://github.com/osmdroid/osmdroid, go to the page and download the latest "release" https://github.com/osmdroid/osmdroid/releases (for example https://github.com/osmdroid/osmdroid/releases/download/osmdroid-parent-5.5/osmdroid-5.5.zip)

If it is grandle, add dependency like this:

dependencies {
    compile 'org.osmdroid:osmdroid-android:(COLOQUE A VERSÃO AQUI):release@aar'
}

If it is Maven:

<dependency>
  <groupId>org.osmdroid</groupId>
  <artifactId>osmdroid-android</artifactId>
  <version>{COLOQUE A VERSÃO AQUI}</version>
  <classifier>release</classifier>
  <type>aar</type>
</dependency>

In the manifest.xml add (Android6+ still requires WRITE_EXTERNAL_STORAGE and ACCESS_COARSE_LOCATION/ACCESS_FINE_LOCATION to use the osmdroid):

<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" />

An example of layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:orientation="vertical" 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <org.osmdroid.views.MapView android:id="@+id/map"
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent" />
</LinearLayout>

More examples of use:

Other projects that use the osmdroid:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.