# AppFunctionState

Artifact: [androidx.appfunctions:appfunctions](https://developer.android.com/jetpack/androidx/releases/appfunctions) [View Source](https://cs.android.com/search?q=file:androidx/appfunctions/AppFunctionState.kt+class:androidx.appfunctions.AppFunctionState) Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

*** ** * ** ***


```
public final class AppFunctionState
```

<br />

*** ** * ** ***

Runtime state of an app function.

This holds properties of an app function that can change at runtime during the app's operation, such as whether the function is enabled.

This is distinct from `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionMetadata`, which represents the metadata that remains constant until the providing package is updated. While `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionMetadata` defines what a function is, the `https://developer.android.com/reference/androidx/appfunctions/AppFunctionState` defines its current operational status.

## Summary

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionState#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/android/util/ArraySet.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/appfunctions/AppFunctionActivityId.html>` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 37) https://developer.android.com/reference/androidx/appfunctions/AppFunctionState#getActivityIds()()` The `https://developer.android.com/reference/android/app/appfunctions/AppFunctionActivityId.html`s this app function is associated with. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appfunctions/AppFunctionName` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionState#getFunctionName()()` The `https://developer.android.com/reference/androidx/appfunctions/AppFunctionName` associated with this state. |
| `int` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionState#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionState#isEnabled()()` Whether this app function can be executed. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appfunctions/AppFunctionState#toString()()` |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getActivityIds

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
@RequiresApi(value = 37)
public final ArraySet<@NonNull AppFunctionActivityId> getActivityIds()
```

The `https://developer.android.com/reference/android/app/appfunctions/AppFunctionActivityId.html`s this app function is associated with.

This will only be non-null when `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionMetadata#scope()` equals to `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionMetadata#SCOPE_ACTIVITY()`. See `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionMetadata#SCOPE_ACTIVITY()` for more details.

### getFunctionName

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
public final @NonNull AppFunctionName getFunctionName()
```

The `https://developer.android.com/reference/androidx/appfunctions/AppFunctionName` associated with this state.

### hashCode

```
public int hashCode()
```

### isEnabled

Added in [1.0.0-rc01](https://developer.android.com/jetpack/androidx/releases/appfunctions#1.0.0-rc01)

```
public final boolean isEnabled()
```

Whether this app function can be executed.

This can be false if:

- The app disabled the function with `https://developer.android.com/reference/androidx/appfunctions/AppFunctionManager#setAppFunctionEnabled(kotlin.String,kotlin.Int)`.

- The function is disabled by default using `https://developer.android.com/reference/android/app/appfunctions/AppFunctionMetadata.html#PROPERTY_ENABLED_BY_DEFAULT` and was never enabled.

- A function without an associated `https://developer.android.com/reference/androidx/appfunctions/AppFunctionService` has not been registered using `https://developer.android.com/reference/androidx/appfunctions/AppFunctionManager#registerAppFunction(kotlin.String,java.util.concurrent.Executor,androidx.appfunctions.AppFunction)` or has been unregistered.

- The process registering the function using `https://developer.android.com/reference/androidx/appfunctions/AppFunctionManager#registerAppFunction(kotlin.String,java.util.concurrent.Executor,androidx.appfunctions.AppFunction)` is frozen, or the `https://developer.android.com/reference/android/content/Context.html` used to register it has been destroyed.

### toString

```
public @NonNull String toString()
```