Created
August 1, 2022 07:36
-
-
Save Suchiq/928ddf855e128d8996c3660b8c0ed49e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean permissionAccessCoarseLocationApproved = | |
ActivityCompat.checkSelfPermission(this, | |
permission.ACCESS_COARSE_LOCATION) == | |
PackageManager.PERMISSION_GRANTED; | |
if (permissionAccessCoarseLocationApproved) { | |
// App has permission to access location in the foreground. Start your | |
// foreground service that has a foreground service type of "location". | |
} else { | |
// Make a request for foreground-only location access. | |
ActivityCompat.requestPermissions(this, new String[] { | |
Manifest.permission.ACCESS_COARSE_LOCATION}, | |
your-permission-request-code); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment