Search in sources :

Example 1 with SimpleLocation

use of im.delight.android.location.SimpleLocation in project BloodHub by kazijehangir.

the class RequestMapFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_request_map, container, false);
    mMapView = (MapView) rootView.findViewById(R.id.mapView);
    mMapView.onCreate(savedInstanceState);
    location = new SimpleLocation(getContext());
    // needed to get the map to display immediately`
    mMapView.onResume();
    // For showing a move to my location button googleMap.setMyLocationEnabled(true);
    if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        setupMap();
    } else {
        // Show rationale and request permission.
        if (permissionRequestCount < REQUEST_LIMIT) {
            permissionRequestCount++;
            ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, MY_PERMISSIONS_REQUEST_FINE_LOCATION);
        }
    }
    return rootView;
}
Also used : SimpleLocation(im.delight.android.location.SimpleLocation) View(android.view.View) MapView(com.google.android.gms.maps.MapView)

Aggregations

View (android.view.View)1 MapView (com.google.android.gms.maps.MapView)1 SimpleLocation (im.delight.android.location.SimpleLocation)1