# SerializationHelper

Artifact: [androidx.wear:wear-ongoing](https://developer.android.com/jetpack/androidx/releases/wear) [View Source](https://cs.android.com/search?q=file:androidx/wear/ongoing/SerializationHelper.java+class:androidx.wear.ongoing.SerializationHelper) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***


```
public class SerializationHelper
```

<br />

*** ** * ** ***

Class used to manage Ongoing Activity information as part of a Bundle or Notification.

## Summary

| ### Public methods |
|---|---|
| `static void` | `https://developer.android.com/reference/androidx/wear/ongoing/SerializationHelper#copy(android.os.Bundle,android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html sourceBundle, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html destinationBundle)` Copies an Ongoing Activity information from a bundle to another, without deserializing and serializing (this needs to be done before accessing the source Bundle) |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` | `https://developer.android.com/reference/androidx/wear/ongoing/SerializationHelper#create(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle)` Deserializes the `https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` from a Bundle. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` | `https://developer.android.com/reference/androidx/wear/ongoing/SerializationHelper#create(android.app.Notification)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notification)` Deserializes the `https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` from a notification. |
| `static boolean` | `https://developer.android.com/reference/androidx/wear/ongoing/SerializationHelper#hasOngoingActivity(android.app.Notification)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notification)` Checks if the given notification contains information of an ongoing activity. |

## Public methods

### copy

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

```
public static void copy(@NonNull Bundle sourceBundle, @NonNull Bundle destinationBundle)
```

Copies an Ongoing Activity information from a bundle to another, without deserializing and serializing (this needs to be done before accessing the source Bundle)

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html sourceBundle` | The bundle to get the Ongoing Activity data from |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html destinationBundle` | The bundle to put the Ongoing Activity data into. |

### create

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

```
public static @Nullable OngoingActivity create(@NonNull Bundle bundle)
```

Deserializes the `https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` from a Bundle.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle` | the bundle that may contain information about a Ongoing Activity. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` | the data, or null of the Bundle doesn't contain Ongoing Activity data. |

### create

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

```
public static @Nullable OngoingActivity create(@NonNull Notification notification)
```

Deserializes the `https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` from a notification.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notification` | the notification that may contain information about a Ongoing Activity. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/ongoing/OngoingActivity` | the data, or null of the notification doesn't contain Ongoing Activity data. |

### hasOngoingActivity

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

```
public static boolean hasOngoingActivity(@NonNull Notification notification)
```

Checks if the given notification contains information of an ongoing activity.