# 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)

*** ** * ** ***


```
public final class AppFunctionPackageMetadata
```

<br />

*** ** * ** ***

Contains metadata about a package providing app functions.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#AppFunctionPackageMetadata(kotlin.String,androidx.appfunctions.metadata.AppFunctionComponentsMetadata)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html packageName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionComponentsMetadata components )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionComponentsMetadata` | `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#getComponents()()` Reusable components that could be shared within the package's functions' specifications. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#getPackageName()()` The name of the package providing app functions. |
| `int` | `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#hashCode()()` |
| `final https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionAppMetadata` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread @https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 31) https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#resolveAppFunctionAppMetadata(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Resolves and parses the `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionAppMetadata` for this package. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionPackageMetadata#toString()()` |

## Public constructors

### AppFunctionPackageMetadata

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

```
public AppFunctionPackageMetadata(
    @NonNull String packageName,
    @NonNull AppFunctionComponentsMetadata components
)
```

## Public methods

### equals

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

### getComponents

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

```
public final @NonNull AppFunctionComponentsMetadata getComponents()
```

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

### getPackageName

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

```
public final @NonNull String getPackageName()
```

The name of the package providing app functions.

### hashCode

```
public int hashCode()
```

### resolveAppFunctionAppMetadata

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

```
@WorkerThread
@RequiresApi(value = 31)
public final AppFunctionAppMetadata resolveAppFunctionAppMetadata(@NonNull Context context)
```

Resolves and parses the `https://developer.android.com/reference/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:

```
<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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | 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/androidx/appfunctions/metadata/AppFunctionAppMetadata` | The parsed `https://developer.android.com/reference/androidx/appfunctions/metadata/AppFunctionAppMetadata` on success, or `null` if the metadata is not defined, the package is not found. |

### toString

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