> For the complete documentation index, see [llms.txt](https://docs.snapodds.com/clipshare-sdk-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapodds.com/clipshare-sdk-docs/mobile-sdk/android/sharing-clips.md).

# Sharing Clips

The following section deals only with presenting the ClipShare functionality once you have performed a successful snap with the SnapOdds SDK.&#x20;

## Implementation

1. Perform Snap via SnapOdds SDK (refer to <https://docs.snapodds.com/docs/mobile-sdk/android/snapodds-operator/snapping-games>)
2. Ensure your class conforms to `ClipShareFragmentResultListener`
3. Instantiate `ClipShareFragment` with the required arguments
4. Handle the result in your listener implementation

### Sharing Clips

The following code illustrates how to present the `ClipShareFragment`. The recommended way is to present this right after you get the callback from the SnapOdds SDK about a snapped sport event, which is also reflected in this code sample.

```kotlin
override fun snapActivityDidSnapSportEvent(
        activity: SnapActivity,
        fragment: SnapFragment,
        sportEvent: SportEventSnapResultEntry
    ) {
        activity.finish()

        val tvChannelId = sportEvent.tvChannel?.id ?: return
        val snapTimestamp = sportEvent.timestamp ?: return
        val authorizationHeader = Snapscreen.instance?.authorizationHeader ?: return

        val epgUnitNameFallback = sportEvent.sportEvent?.league ?: sportEvent.sportEvent?.tournament ?: sportEvent.sportEvent?.sport

        parentFragmentManager.beginTransaction()
            .replace(
                R.id.fragment_container,
                ClipShareFragment.newInstance(
                    tvChannelId = tvChannelId,
                    tvChannelLogoUrl = sportEvent.tvChannel?.logoURL,
                    tvChannelName = sportEvent.tvChannel?.name,
                    epgUnitNameFallback = epgUnitNameFallback,
                    snapTimestamp = snapTimestamp,
                    snapscreenAuthorizationHeader = authorizationHeader,
                    listener = this
                )
            )
            .addToBackStack(ClipShareFragment::class.java.canonicalName)
            .commit()
    }
```

When the user successfully trims a desired clip, the following method is called in your `ClipShareFragmentResultListener`:

```kotlin
override fun clipShareFragmentDidCreateClip(fragment: ClipShareFragment, clip: Clip) {
  // add desired behaviour here
}
```

When the clip could not be created for any reason, the following method is called in your `ClipShareFragmentResultListener`:

```kotlin
override fun clipShareFragmentDidFailCreatingClip(fragment: ClipShareFragment) {
  // add desired behaviour here
}
```

When no clip information for the provided Snap Result could be loaded, the following method is called in your `ClipShareFragmentResultListener`:

```kotlin
override fun clipShareFragmentDidFailLoadingClip(fragment: ClipShareFragment) {
  // add desired behaviour here
}
```

Additionally it is (very rarely) possible that the loaded clip is not long enough to support trimming. In that case the following method is called in your `ClipShareFragmentResultListener`:

```kotlin
override fun clipShareFragmentDidFailWithTooShortClip(fragment: ClipShareFragment) {
  // add desired behaviour here
}
```
