Code example for GoogleMap

Methods: isMyLocationEnabled, setMyLocationEnabled

0
    private boolean checkLocationAccess() { 
        boolean gps_enabled = mLocationManager.isProviderEnabled(mNetworkProvider);
        boolean network_enabled = mLocationManager.isProviderEnabled(mNetworkProvider);
 
        if(gps_enabled && network_enabled){
            if(!map.isMyLocationEnabled()){
                map.setMyLocationEnabled(true);
            } 
 
            return true; 
        } 
        else{ 
            mLocationTextView.setText("Enable Location Access");
            map.setMyLocationEnabled(false);
 
            return false; 
        } 
    } 
    private void updateMarkerAndLocationAddress(Location location) {
        updateLocationAddressText(location);
        updateMarker(location);