Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
About google map in android
M.Dharani Masilamani
Jan 24 2018 11:22 PM
137
Reply
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;
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
External storage access denied in xamarin android
Fetch User Data According to login Details.