About google map in android

Jan 24 2018 11:22 PM
  1. public static final int MY_PERMISSIONS_REQUEST_LOCATION = 90;  
  2.  public boolean checkLocationPermission(){  
  3.  if (ContextCompat.checkSelfPermission(this,  
  4.                 Manifest.permission.ACCESS_FINE_LOCATION)  
  5.                 != PackageManager.PERMISSION_GRANTED) {  
  6.   
  7.   
  8.  if (ActivityCompat.shouldShowRequestPermissionRationale(this,  
  9.                     Manifest.permission.ACCESS_FINE_LOCATION)) {  
  10.   
  11.   
  12.                 ActivityCompat.requestPermissions(this,  
  13.  new String[]{Manifest.permission.ACCESS_FINE_LOCATION},  
  14.  MY_PERMISSIONS_REQUEST_LOCATION);  
  15.   
  16.   
  17.             } else {  
  18.   
  19.                 ActivityCompat.requestPermissions(this,  
  20.  new String[]{Manifest.permission.ACCESS_FINE_LOCATION},  
  21.  MY_PERMISSIONS_REQUEST_LOCATION);  
  22.             }  
  23.  return false;  
  24.         } else {  
  25.  return true;  
  26.         }  
  27.     }  
  28.   
  29.  @Override  
  30.  public void onRequestPermissionsResult(int requestCode,  
  31.                                            String permissions[], int[] grantResults) {  
  32.  switch (requestCode) {  
  33.  case MY_PERMISSIONS_REQUEST_LOCATION: {  
  34.   
  35.  if (grantResults.length > 0  
  36.  && grantResults[0] == PackageManager.PERMISSION_GRANTED) {  
  37.   
  38.   
  39.  if (ContextCompat.checkSelfPermission(this,  
  40.                             Manifest.permission.ACCESS_FINE_LOCATION)  
  41.                             == PackageManager.PERMISSION_GRANTED) {  
  42.   
  43.  if (mGoogleApiClient == null) {  
  44.                             buildGoogleApiClient();  
  45.                         }  
  46.  mMap.setMyLocationEnabled(true);  
  47.                     }  
  48.   
  49.                 } else {  
  50.   
  51.   
  52.                     Toast.makeText(this"permission denied", Toast.LENGTH_LONG).show();  
  53.                 }  
  54.  return;  
  55.             }  
  56.   
  57.   
  58.         }  
  59.     }  
  60. }  
I am new to android in first line why we assignmy_permissions_request_location =90.
 
MY_PERMISSIONS_REQUEST_LOCATION = 90;

Answers (1)