Permission UI
A set of Android-UI components to make it easier to request permission in a user friendly way.
Access background location
A jetpack compose module to easy request background location permission in a intuitive way.
How to include in your project
The library is available via MavenCentral:
allprojects {
repositories {
// ...
mavenCentral()
}
}
Add it to your module dependencies:
dependencies {
implementation("se.warting.permissionsui:permissionsui:
")
}
Snapshots of the development version are available in Sonatype's snapshots repository.
allprojects {
repositories {
// ...
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}
How to use
All you need to do is to call LocationInBackgroundTutorialView
:
LocationInBackgroundTutorialView() {
// Permissions granted
}
Example:
import se.warting.permissionsui.backgroundlocation.LocationInBackgroundTutorialView
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BackgroundLocationPermissionRationaleTheme {
Surface(color = MaterialTheme.colors.background) {
LocationInBackgroundTutorialView() {
// Permissions granted
}
}
}
}
}
}
For a full implementation see: Full sample
Notes
This Library adds the following permissions to your app:
- android.permission.ACCESS_COARSE_LOCATION
- android.permission.ACCESS_FINE_LOCATION
- android.permission.ACCESS_BACKGROUND_LOCATION
Samples
SDK | Happy case | Rationale case | Worst case |
---|---|---|---|
10 | |||
12 |