# TestLocationButtonProvider

Artifact: [androidx.core.locationbutton:locationbutton-testing](https://developer.android.com/jetpack/androidx/releases/core-locationbutton) [View Source](https://cs.android.com/search?q=file:androidx/core/locationbutton/testing/TestLocationButtonProvider.kt+class:androidx.core.locationbutton.testing.TestLocationButtonProvider) Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/core-locationbutton#1.0.0-alpha01)

*** ** * ** ***

<br />

```
open class TestLocationButtonProvider : LocationButtonProvider
```

<br />

*** ** * ** ***

A test implementation of `LocationButtonProvider` which provides a fake of the LocationButton and provides additional methods to allow tests to fake user interactions so that the client side flows can be tested.

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider` | `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider#create()()` Construct a `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider` that runs a fake location button session. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider#TestLocationButtonProvider(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider#notifyPermissionResult(android.app.permissionui.LocationButtonSession,kotlin.Boolean)( session: https://developer.android.com/reference/android/app/permissionui/LocationButtonSession.html, isGranted: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider#openSession(android.app.Activity,android.os.IBinder,kotlin.Int,android.app.permissionui.LocationButtonRequest,java.util.concurrent.Executor,android.app.permissionui.LocationButtonClient)( activity: https://developer.android.com/reference/android/app/Activity.html, hostToken: https://developer.android.com/reference/android/os/IBinder.html, displayId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, request: https://developer.android.com/reference/android/app/permissionui/LocationButtonRequest.html, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, client: https://developer.android.com/reference/android/app/permissionui/LocationButtonClient.html )` |

| ### Protected functions |
|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider#onSessionRequestReceived(android.app.permissionui.LocationButtonRequest,android.app.permissionui.LocationButtonSession)( request: https://developer.android.com/reference/android/app/permissionui/LocationButtonRequest.html, session: https://developer.android.com/reference/android/app/permissionui/LocationButtonSession.html )` |

## Public companion functions

### create

Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/core-locationbutton#1.0.0-alpha01)

```
fun create(): TestLocationButtonProvider
```

Construct a `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider` that runs a fake location button session.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/locationbutton/testing/TestLocationButtonProvider` | A test only implementation of `LocationButtonProvider`. |

## Public constructors

### TestLocationButtonProvider

Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/core-locationbutton#1.0.0-alpha01)

```
TestLocationButtonProvider(context: Context)
```

## Public functions

### notifyPermissionResult

Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/core-locationbutton#1.0.0-alpha01)

```
fun notifyPermissionResult(
    session: LocationButtonSession,
    isGranted: Boolean
): Unit
```

### openSession

Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/core-locationbutton#1.0.0-alpha01)

```
open fun openSession(
    activity: Activity,
    hostToken: IBinder,
    displayId: Int,
    request: LocationButtonRequest,
    executor: Executor,
    client: LocationButtonClient
): Unit
```

## Protected functions

### onSessionRequestReceived

Added in [1.0.0-alpha01](https://developer.android.com/jetpack/androidx/releases/core-locationbutton#1.0.0-alpha01)

```
protected open fun onSessionRequestReceived(
    request: LocationButtonRequest,
    session: LocationButtonSession
): Unit
```