warting / permissions-ui

Background location permissions request helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maven Central Crowdin

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.

happy case gif

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.

Sonatype Nexus (Snapshots)

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 happy case gif rationale case gif worst case gif
12 happy case gif rationale case gif worst case gif

About

Background location permissions request helper

License:MIT License


Languages

Language:Kotlin 94.3%Language:Java 3.8%Language:Shell 2.0%