google android map in my app

Asked

Viewed 80 times

0

I’m starting now to create my first app on android ever created apps for other platforms, so wanted to know how I put google map or Bing in my app.

2 answers

2

After reading your question I just addressed the Google and in less than 10 seconds I found this: https://developer.android.com/training/maps/index.html. Read carefully that says it all there.

EDIT:

To be more precise and not to be "lost" the search I leave you here the following piece of code available on the page I suggested.

import com.google.android.gms.maps.*;
import com.google.android.gms.maps.model.*;
import android.app.Activity;
import android.os.Bundle;

public class MapPane extends Activity implements OnMapReadyCallback {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map_activity);

        MapFragment mapFragment = (MapFragment) getFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap map) {
        LatLng sydney = new LatLng(-33.867, 151.206); /* AQUI A ALTITUDE E LONGITUDE */

        map.setMyLocationEnabled(true);
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));

        map.addMarker(new MarkerOptions()
                .title("Sydney") /* TITULO DA CIDADE */
                .snippet("The most populous city in Australia.") /* LABEL OU SEJA, UMA PEQUENA DESCRIÇÃO */
                .position(sydney));
    }
}

Regards, thecreator

0

A quick way, for you who are a beginner, is to create a Google Maps Activity

inserir a descrição da imagem aqui

It already generates an . xml for you to insert the maps key and already provides you a link of how to generate this key.

inserir a descrição da imagem aqui

More information on Getting Started from Google Maps V2: https://developers.google.com/maps/documentation/android/start

  • Thank you so much for your help

Browser other questions tagged

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