GoogleMap setMyLocationEnabled - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for GoogleMap setMyLocationEnabled method.

This code example shows how to use the following methods:animateCamera, setMyLocationEnabled
package com.novoda.mapdemo.fragment; 
 
import android.content.Context; 
import android.location.Location; 
import android.location.LocationManager; 
import android.os.Bundle; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
import com.google.android.gms.maps.CameraUpdate; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.LatLng; 
 
public class NovodaMapFragment extends SupportMapFragment {
 
    private static final int ZOOM_LEVEL = 16;
    private GoogleMap map;
 

8
CodeRank
This code example shows how to use the following methods:addCircle, addMarker, clear, getCameraPosition, setLocationSource
	public MapHelperClass(GoogleMap map, int distanceWhenWPReached) {
 
		this.map = map;
		this.distanceWhenWPReached = distanceWhenWPReached;
 
		map.setLocationSource(this);
		map.setMyLocationEnabled(true);
		map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
 
		CleanMap(); 
	} 
 
	public void RedrawLines() { 
		if (WPPathPolyLine != null) {
			WPPathPolyLine.remove();
			WPPathPolyLine = null;
		} 
		PolylineOptions polylineOptions = new PolylineOptions().color(Color.CYAN).width(4);
		for (Marker m : markers) {
			polylineOptions.add(m.getPosition());

7
CodeRank
This code example shows how to use the following methods:setMyLocationEnabled, setOnInfoWindowClickListener, setOnMarkerClickListener
This code example shows how to use the following methods:addMarker, getUiSettings, moveCamera, setMapType, setMyLocationEnabled
        super.onResume(); 
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMap() { 
        mMap.addMarker(new MarkerOptions().position(new LatLng(37.233181, -76.646596)).title("Austria"));
        mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
        mMap.setMyLocationEnabled(false);
        mMap.getUiSettings().setZoomControlsEnabled(false);
        mMap.moveCamera(CameraUpdateFactory.newCameraPosition(HOME));
    } 
 
    private void setUpMapIfNeeded() { 
        // Do a null check to confirm that we have not already instantiated the map. 
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment. 
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map. 
            if (mMap != null) {
6
CodeRank
This code example shows how to use the following methods:getUiSettings, setIndoorEnabled, setMapType, setMyLocationEnabled, setTrafficEnabled
package com.tdispatch.passenger.fragment; 
 
import android.os.Bundle; 
import android.view.LayoutInflater; 
import android.view.SurfaceView; 
import android.view.View; 
import android.view.ViewGroup; 
 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.UiSettings; 
import com.webnetmobile.tools.WebnetLog; 
 
/* 
6
CodeRank
This code example shows how to use the following methods:addMarker, getUiSettings, moveCamera, setMapType, setMyLocationEnabled
        super.onResume(); 
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMap() { 
        mMap.addMarker(new MarkerOptions().position(new LatLng(37.235983,-76.647475)).title("Scandinavia"));
        mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
        mMap.setMyLocationEnabled(false);
        mMap.getUiSettings().setZoomControlsEnabled(false);
        mMap.moveCamera(CameraUpdateFactory.newCameraPosition(HOME));
    } 
 
    private void setUpMapIfNeeded() { 
        // Do a null check to confirm that we have not already instantiated the map. 
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment. 
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map. 
            if (mMap != null) {
6
CodeRank
This code example shows how to use the following methods:addMarker, animateCamera, getUiSettings, moveCamera, setMapType
         
        LatLng CENTRO = new LatLng(lati1, lngi1);
         
         
		 
		nMapa.addMarker(new MarkerOptions()
				.position(new LatLng(lati1, lngi1))
				.title(name)
				.snippet("pensamos en el futuro"));
		nMapa.setMapType(GoogleMap.MAP_TYPE_NORMAL);
		nMapa.moveCamera(CameraUpdateFactory.newLatLngZoom(CENTRO, 15));
		nMapa.animateCamera(CameraUpdateFactory.zoomIn());
		nMapa.setMyLocationEnabled(true);
		nMapa.getUiSettings().setCompassEnabled(true);
	} 
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present. 
		getMenuInflater().inflate(R.menu.activity_main, menu);
		 
6
CodeRank
This code example shows how to use the following methods:animateCamera, getUiSettings, moveCamera, setMapType, setMyLocationEnabled
package mobi.tongari.mokutan.ui; 
 
import java.util.ArrayList; 
import java.util.HashMap; 
import java.util.List; 
import java.util.Map; 
 
import mobi.tongari.mokutan.R; 
import android.location.Criteria; 
import android.location.Location; 
import android.location.LocationManager; 
import android.support.v4.app.FragmentActivity; 
 
import com.google.android.gms.maps.CameraUpdate; 
import com.google.android.gms.maps.CameraUpdateFactory; 
import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.SupportMapFragment; 
import com.google.android.gms.maps.model.CameraPosition; 
import com.google.android.gms.maps.model.LatLng; 
import com.google.android.gms.maps.model.Marker; 

6
CodeRank
This code example shows how to use the following methods:addMarker, getUiSettings, moveCamera, setMapType, setMyLocationEnabled
        super.onResume(); 
        setUpMapIfNeeded(); 
    } 
 
    private void setUpMap() { 
        mMap.addMarker(new MarkerOptions().position(new LatLng(37.233305,-76.648709)).title("Canada"));
        mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
        mMap.setMyLocationEnabled(false);
        mMap.getUiSettings().setZoomControlsEnabled(false);
        mMap.moveCamera(CameraUpdateFactory.newCameraPosition(HOME));
    } 
 
    private void setUpMapIfNeeded() { 
        // Do a null check to confirm that we have not already instantiated the map. 
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment. 
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map. 
            if (mMap != null) {
6
CodeRank
This code example shows how to use the following methods:addMarker, animateCamera, moveCamera, setMapType, setMyLocationEnabled
 
    } 
 
    private void setUpMap() { 
        // Enable Location 
        googleMap.setMyLocationEnabled(true);
 
        // get Location manager 
        LocationManager locationManager = (LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE);
 
        // Create Criteria Object to Retrieve Provider 
        Criteria criteria = new Criteria();
 
        // Get the name of the Best Provider 
        String provider = locationManager.getBestProvider(criteria, true);
 
        //Current Location 
 
        Location location = locationManager.getLastKnownLocation(provider);
 

6
CodeRank

Related GoogleMap setMyLocationEnabled Questions & Answers:

setMyLocationEnabled Method Overview
Enables or disables the my-location layer.
See Code Examples for other Android GoogleMap Methods: