I want to detect my location, I am using ACCESS_FINE_LOCATION permission but when I run app, it crashes and on the screen occurs error message: 
"AppName" has stopped working
Following is my code, I am using to implement the above said:
public class MainActivity extends AppCompatActivity {
    LocationManager locationManager;
    Location location;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);
       locationManager = (LocationManager) 
                       getSystemService(Context.LOCATION_SERVICE);
       if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
           return;
       }
       location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
       Log.v("My Coordinates are: ", location.getLatitude() + " " + location.getLongitude());
    }
}
What am I doing wrong here?
Please Help.
 
     
    