Skip to content

Commit

Permalink
Merge pull request #910 from kienvo/fix-permission-crash
Browse files Browse the repository at this point in the history
fix: Crash caused by missing permission
  • Loading branch information
mariobehling authored May 11, 2024
2 parents 17f9f49 + e733ce7 commit 7c4d9b8
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,23 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi

private fun checkManifestPermission() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_ADMIN) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH_PRIVILEGED) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(this, Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_GRANTED &&
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED
) {
Timber.i { "Coarse permission granted" }
} else {
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE), REQUEST_PERMISSION_CODE)
ActivityCompat.requestPermissions(
this,
arrayOf(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.BLUETOOTH_ADMIN,
Manifest.permission.BLUETOOTH_PRIVILEGED,
Manifest.permission.BLUETOOTH
),
REQUEST_PERMISSION_CODE
)
}
}

Expand Down

0 comments on commit 7c4d9b8

Please sign in to comment.