Permission-UI

Additional

Language
Kotlin
Version
v0.1.12 (Jan 27, 2022)
Created
Sep 17, 2021
Updated
Mar 22, 2022
Owner
Stefan Wärting (warting)
Contributors
dependabot[bot]
Stefan Wärting (warting)
2
Activity
Badge
Generate
Download
Source code

Advertising

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:<latest_version>")
}
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 
                    }
                }
            }
        }
    }
}

If you are not using compose in your app you can use PermissionsUiContracts.RequestBackgroundLocation See: kotlin sample or java sample

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