# AppFunctionPackageMetadata

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

*** ** * ** ***


```
class AppFunctionPackageMetadata
```

<br />

*** ** * ** ***

Contains metadata about a package providing app functions.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#AppFunctionPackageMetadata(kotlin.String,androidx.appfunctions.metadata.AppFunctionComponentsMetadata)( packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, components: https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionComponentsMetadata )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#hashCode()()` |
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionAppMetadata?` | `@https://developer.android.com/reference/kotlin/androidx/annotation/WorkerThread @https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 31) https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#resolveAppFunctionAppMetadata(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Resolves and parses the `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionAppMetadata` for this package. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#toString()()` |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionComponentsMetadata` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#components()` Reusable components that could be shared within the package's functions' specifications. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionPackageMetadata#packageName()` The name of the package providing app functions. |

## Public constructors

### AppFunctionPackageMetadata

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

```
AppFunctionPackageMetadata(
    packageName: String,
    components: AppFunctionComponentsMetadata
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### resolveAppFunctionAppMetadata

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

```
@WorkerThread
@RequiresApi(value = 31)
fun resolveAppFunctionAppMetadata(context: Context): AppFunctionAppMetadata?
```

Resolves and parses the `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionAppMetadata` for this package.

This function parses the AppFunctionAppMetadata from the XML file specified in the `AndroidManifest.xml` within the `<application>` tag, where it is linked as a resource using a `<property>` tag with the name `android.app.appfunctions.app_metadata`.

For example, in target app's AndroidManifest this will be defined as:

```kotlin
<application ...>
 ...
 <property
     android:name="android.app.appfunctions.app_metadata"
     android:resource="@xml/your_metadata_file" />
</application>
```

This method should be called on a background/worker thread as it reads resources from another app.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The `https://developer.android.com/reference/android/content/Context.html` used to access the resources. Any resource references in the metadata, are resolved using this context's current configuration (e.g., for localization). |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionAppMetadata?` | The parsed `https://developer.android.com/reference/kotlin/androidx/appfunctions/metadata/AppFunctionAppMetadata` on success, or `null` if the metadata is not defined, the package is not found. |

### toString

```
open fun toString(): String
```

## Public properties

### components

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

```
val components: AppFunctionComponentsMetadata
```

Reusable components that could be shared within the package's functions' specifications.

### packageName

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

```
val packageName: String
```

The name of the package providing app functions.