-
-
Save parzibyte/1761a1e1dcbc19752fc36da886c13a55 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
private fun verificarPermisos() { | |
val permisos = arrayListOf( | |
Manifest.permission.ACCESS_COARSE_LOCATION, | |
Manifest.permission.ACCESS_FINE_LOCATION, | |
) | |
// Segundo plano para Android Q | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { | |
permisos.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION) | |
} | |
val permisosComoArray = permisos.toTypedArray() | |
if (tienePermisos(permisosComoArray)) { | |
haConcedidoPermisos = true | |
// Los permisos ya fueron concedidos | |
} else { | |
solicitarPermisos(permisosComoArray) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment