> ## Documentation Index
> Fetch the complete documentation index at: /llms.txt
> Use this file to discover all available pages before exploring further.

# Global Feed

> Query the chronological global feed and refresh it on Android.

Global feed returns a paginated collection of posts for the current user's global feed surface. Use data type filters when your UI only needs a subset of post types, such as an image or video feed.

```typescript TypeScript theme={null}
import { FeedRepository } from '@amityco/ts-sdk';

let loadNextPage: (() => void) | undefined;
let canLoadMore = false;

const unsubscribe = FeedRepository.getGlobalFeed(
  {
    dataTypes: ['image', 'video'],
    includeMixedStructure: true,
    limit: 20,
  },
  ({ data: posts, onNextPage, hasNextPage, loading, error }) => {
    if (loading) return;
    if (error) {
      handleError(error);
      return;
    }

    renderResults(posts);
    loadNextPage = onNextPage;
    canLoadMore = hasNextPage;
  },
);

function loadMoreGlobalFeed() {
  if (canLoadMore) {
    loadNextPage?.();
  }
}

unsubscribe();
```

```swift iOS theme={null}
token = feedRepository
    .getGlobalFeed(dataTypes: Set(["image", "video"]), includeMixedStructure: true)
    .observe { collection, error in
        if let error {
            handleError(error)
            return
        }

        showSuccessMessage(collection.snapshots.count)
    }
```

```kotlin Android theme={null}
AmitySocialClient.newFeedRepository()
    .getGlobalFeed()
    .dataTypes(listOf(AmityPost.DataType.IMAGE, AmityPost.DataType.VIDEO))
    .includeMixedStructure(includeMixedStructure = true)
    .build()
    .query()
    .subscribe(
        { pagingData: PagingData<AmityPost> -> showSuccessMessage(pagingData) },
        { error -> handleGeneralError(error) }
    )
```

```dart Flutter theme={null}
final page = await AmitySocialClient.newFeedRepository()
    .getGlobalFeed()
    .types([AmityDataType.IMAGE, AmityDataType.VIDEO])
    .getPagingData(limit: 20);

final posts = page.data;
showError(posts.length);
```

> [!NOTE]
>
> The global feed shows at most the 20 most recent posts per user or community. Older posts from the same source are not included.

## Parameters

| Parameter | Platforms | Required | Description |
| - | - | - | - |
| `dataTypes` | All | No | Filter the global feed to specific post content types where supported. |
| `includeMixedStructure` | All | No | Include mixed-structure posts alongside the requested data type filters. |
| `limit`, `onNextPage`, `hasNextPage` | TypeScript | No | Control page size and load additional pages from the live collection callback. |
| `invalidateCache` | Android | No | Skip cached paging data for deliberate refresh flows. |

## Android cache invalidation

Android feed builders expose `invalidateCache(true)`. Use it for deliberate refresh flows, such as pull-to-refresh, when the first page should not reuse the existing paging cache.

```kotlin Android theme={null}
AmitySocialClient.newFeedRepository()
    .getGlobalFeed()
    .invalidateCache(invalidateCache = true)
    .build()
    .query()
    .subscribe(
        { pagingData: PagingData<AmityPost> -> showSuccessMessage(pagingData) },
        { error -> handleGeneralError(error) }
    )
```

> [!NOTE]
>
> `invalidateCache` is an Android feed-query option in the current SDK surface reviewed for this page.

## Related Topics

> [card] [Global Feed UIKit](/uikit/components/social/feeds.md#global-feed-component)
>
> Render the chronological global feed with the prebuilt UIKit component.

> [card] [Custom-Ranking Global Feed](/social-plus-sdk/social/discovery-engagement/feed/custom-ranking.md)
>
> The same content, ordered by engagement instead of by time.

> [card] [Query Posts](/social-plus-sdk/social/content-management/posts/retrieval/query-posts.md)
>
> Query user and community post collections with more filters.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.