Replace 'Google Maps' with 'Open Street Maps' for Travel-Mate Android App

in #utopian-io6 years ago (edited)

Repository

Github

Project

The app provides users with various features from choosing the correct destination to making all the bookings and to easily organizing the trip. The app provides solutions for every possible problem a traveller might face during the course of his or her entire journey.

Bug Fixes

417

What was the issue(s)?

In many places of the application Google map was used using map API key. OSM describes itself as an open data source, meaning that any person or company is able to use the map information contained in OpenStreetMap.

What was the solution?

-Referance open street map https://wiki.openstreetmap.org/wiki/Android.

  • -

    Replaced com.google.android.gms:play-services-maps with org.osmdroid:osmdroid-android

    - Removed meta other api_key from source code. - Replaced Google mapview layout with

    <org.osmdroid.views.MapView
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.4"/>

    - In the respective activity below code to initialise and render the map

    /**
    * On open street map initialize
    */
    private void initMap() {
    mMap.setBuiltInZoomControls(false);
    mMap.setMultiTouchControls(true);
    mMap.setTilesScaledToDpi(true);
    mController = mMap.getController();
    MyLocationNewOverlay mLocationoverlay = new MyLocationNewOverlay(mMap);
    mLocationoverlay.enableFollowLocation();
    mLocationoverlay.enableMyLocation();
    mMap.getOverlays().add(mLocationoverlay);
    mController.setZoom(14);
    }

    - Used the below logic to add Marker Item overlay on OSM.

    marker.setPosition(coord);
    marker.setIcon(this.getResources().getDrawable(locationIcon));
    marker.setTitle(locationName);
    marker.setOnMarkerClickListener(this);

Demo

Pull Request

452

GitHub Account

Github

Sort:  

Hi, @hiremani. Your account has been excluded from Utopian rewards and therefore this contribution post will not be reviewed. You can contact us at https://support.utopian.io/ if you have any further questions.

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63188.04
ETH 2570.49
USDT 1.00
SBD 2.79