0

es posible que al hacer click en algun "mark" de mi app, este pueda redireccionarse a la App de Google Maps?

Markers google maps

public class UbicacionFragment extends Fragment implements OnMapReadyCallback {

GoogleMap map;
public UbicacionFragment() {
    // Required empty public constructor
}


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v =  inflater.inflate(R.layout.fragment_ubicacion, container, false);

    return v;
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    SupportMapFragment mapFragment = (SupportMapFragment)
            getChildFragmentManager().findFragmentById(R.id.map1);
    mapFragment.getMapAsync(this);

}

@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;

    LatLng a = new LatLng(25.666376, -100.26546559999997);
    MarkerOptions options = new MarkerOptions();
    options.position(a).title("HR DESECHABLES GUADALUPE");
    options.position(a).snippet("José Sixto Verduzco 800, Central de Abastos, 67147 Monterrey, N.L.");
    map.addMarker(options);
    map.moveCamera(CameraUpdateFactory.newLatLng(a));

    LatLng d = new LatLng(25.5920038565153, -100.00365257263184 );
    MarkerOptions options3 = new MarkerOptions();
    options3.position(d).title("HR DESECHABLES CADEREYTA");
    options3.position(d).snippet("Av. Benito Juárez, 67450 Cadereyta Jiménez, N.L, México ");
    map.addMarker(options3);
    map.moveCamera(CameraUpdateFactory.newLatLng(d));

    LatLng f = new LatLng( 22.7619524, -102.54727409999998);
    MarkerOptions options5 = new MarkerOptions();
    options5.position(f).title("HR DESECHABLES ZACATECAS");
    options5.position(f).snippet("José López Portillo 1, Tres Cruces, 98064 Zacatecas, Zac., México");
    map.addMarker(options5);
    map.moveCamera(CameraUpdateFactory.newLatLng(f));

    LatLng g = new LatLng(25.747448 , -100.198314 );
    MarkerOptions options6 = new MarkerOptions();
    options6.position(g).title("HR DESECHABLES APODACA");
    options6.position(g).snippet("Blvrd Julian Treviño Elizondo 222A, El Milagro, 66634 Cd Apodaca, N.L., México");
    map.addMarker(options6);
    map.moveCamera(CameraUpdateFactory.newLatLng(g));


}}
2
  • Quieres que te de la opción de ir a google maps al hacer click en las direcciones que tienes predeterminadas ?
    – Ashley G.
    el 6 nov. 2017 a las 20:01
  • Si así es. Quiero que al hacer click en alguna dirección se abra Google maps. el 6 nov. 2017 a las 20:02

2 respuestas 2

1

San Google te da la opción en la esquina inferior.

1. Te muestro en mi app tengo esta dirección predeterminada

introducir la descripción de la imagen aquí

2. Ahora al pulsar la dirección(El market) en la parte inferior en la esquina te muestra

introducir la descripción de la imagen aquí

Entre el + y - (El zoom) y el compartir es la opción de ir a la Google maps con tu dirección.

2
  • Vaya, esa parte la tenia oculta debajo de un menú y la pase por alto, gracias. el 6 nov. 2017 a las 20:28
  • De nada, que bueno que te haya ayudado. Saludos
    – Ashley G.
    el 6 nov. 2017 a las 20:29
-1

Puedes usar un listener setOnInfoWindowClickListener para detectar un click en el marcador y abrir la url que deseas:

map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
    @Override
    public void onInfoWindowClick(Marker marker) {
        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com"));
        startActivity(intent);
    }
});

Tu Respuesta

Al pulsar en “Publica tu respuesta”, muestras tu consentimiento a nuestros términos de servicio, política de privacidad y política de cookies

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.