- public static final int MY_PERMISSIONS_REQUEST_LOCATION = 90;
- public boolean checkLocationPermission(){
- if (ContextCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_FINE_LOCATION)
- != PackageManager.PERMISSION_GRANTED) {
-
-
- if (ActivityCompat.shouldShowRequestPermissionRationale(this,
- Manifest.permission.ACCESS_FINE_LOCATION)) {
-
-
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
- MY_PERMISSIONS_REQUEST_LOCATION);
-
-
- } else {
-
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
- MY_PERMISSIONS_REQUEST_LOCATION);
- }
- return false;
- } else {
- return true;
- }
- }
-
- @Override
- public void onRequestPermissionsResult(int requestCode,
- String permissions[], int[] grantResults) {
- switch (requestCode) {
- case MY_PERMISSIONS_REQUEST_LOCATION: {
-
- if (grantResults.length > 0
- && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-
-
- if (ContextCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_FINE_LOCATION)
- == PackageManager.PERMISSION_GRANTED) {
-
- if (mGoogleApiClient == null) {
- buildGoogleApiClient();
- }
- mMap.setMyLocationEnabled(true);
- }
-
- } else {
-
-
- Toast.makeText(this, "permission denied", Toast.LENGTH_LONG).show();
- }
- return;
- }
-
-
- }
- }
- }
I am new to android in first line why we assignmy_permissions_request_location =90.
MY_PERMISSIONS_REQUEST_LOCATION = 90;