# SerializationHelper

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/ongoing/SerializationHelper "View this page in Java")

<br />

```
class SerializationHelper
```

<br />

*** ** * ** ***

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

## Summary

|                                                   ### Public functions                                                   |
|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                              | [copy](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/SerializationHelper#copy(android.os.Bundle,android.os.Bundle))`(sourceBundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`, destinationBundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`)` Copies an Ongoing Activity information from a bundle to another, without deserializing and serializing (this needs to be done before accessing the source Bundle) |
| `java-static `[OngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/OngoingActivity)`?` | [create](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/SerializationHelper#create(android.os.Bundle))`(bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`)` Deserializes the[OngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/OngoingActivity)from a Bundle.                                                                                                                                                |
| `java-static `[OngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/OngoingActivity)`?` | [create](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/SerializationHelper#create(android.app.Notification))`(notification: `[Notification](https://developer.android.com/reference/android/app/Notification.html)`)` Deserializes the[OngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/OngoingActivity)from a notification.                                                                                                                |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                        | [hasOngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/SerializationHelper#hasOngoingActivity(android.app.Notification))`(notification: `[Notification](https://developer.android.com/reference/android/app/Notification.html)`)` Checks if the given notification contains information of an ongoing activity.                                                                                                                                                      |

## Public functions

### copy

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

```
java-static fun copy(sourceBundle: Bundle, destinationBundle: Bundle): Unit
```

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                                           |
|-----------------------------------------------------------------------------------------------|---------------------------------------------------|
| `sourceBundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)      | The bundle to get the Ongoing Activity data from  |
| `destinationBundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html) | 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)  

```
java-static fun create(bundle: Bundle): OngoingActivity?
```

Deserializes the[OngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/OngoingActivity)from a Bundle.  

|                                     Parameters                                     |
|------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `bundle: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html) | the bundle that may contain information about a Ongoing Activity. |

|                                                  Returns                                                   |
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [OngoingActivity](https://developer.android.com/reference/kotlin/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)  

```
java-static fun create(notification: Notification): OngoingActivity?
```

Deserializes the[OngoingActivity](https://developer.android.com/reference/kotlin/androidx/wear/ongoing/OngoingActivity)from a notification.  

|                                              Parameters                                               |
|-------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| `notification: `[Notification](https://developer.android.com/reference/android/app/Notification.html) | the notification that may contain information about a Ongoing Activity. |

|                                                  Returns                                                   |
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| [OngoingActivity](https://developer.android.com/reference/kotlin/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)  

```
java-static fun hasOngoingActivity(notification: Notification): Boolean
```

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