When adding permissions to my manifest file, the below xml works.
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED
|| checkSelfPermission(android.Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
mapView.setMyLocationEnabled(true);
}
}
else
{
mapView.setMyLocationEnabled(true);
}