Skip to main content

Sample apps

Each platform has a sample app that shows a complete integration: initialization, SSO, navigation, theming and more. Run it with your own API key to see the community working before you integrate it in your app.

Before you begin​

  • An API key for a sandbox community. Request one from the form on octopuscommunity.com.
  • To sign users in with SSO, a way to get a user token: either your community's token secret, used by some samples to sign a JWT locally, or a JWT from your backend. See Generate a signed JWT.
  • The toolchain of your platform: see Requirements.
danger

Some samples sign the SSO JWT inside the app with your community's token secret, only to make the demo self-contained. Never put this secret in an app you ship: anyone could extract it and sign in as any user. In your app, the JWT always comes from your backend.

Which sample shows what​

PlatformRepositoryWhat it covers
Androidoctopus-sdk-androidOne app with navigation, theming, SSO, bridges and push notification scenarios.
iOSoctopus-sdk-swiftA Scenarios tab (SSO, theming, bridges, events and more), the embedded Community tab, and Settings.
Flutteroctopus-sdk-flutterThe example app, with SSO and the reactive APIs.
React Nativeoctopus-sdk-react-nativeThe example app, whose Scenarios tab walks through most of the reactive and analytics APIs.
Unityoctopus-sdk-unityThe UnityExample project, and importable samples for push notifications and groups.

Run the sample​

The sample module is the canonical showcase: Configuration, Scenarios, Community, Settings and a Debug console. Scenarios cover navigation, theming, SSO, bridge content and push in one app. It needs JDK 17 and Android SDK 36, or Android Studio.

  1. Clone the repository and add your API key to local.properties at its root:

    git clone https://github.com/Octopus-Community/octopus-sdk-android.git && cd octopus-sdk-android
    echo "OCTOPUS_API_KEY=YOUR_API_KEY" >> local.properties
  2. To sign users in with SSO, also add your community's token secret. The sample uses it to sign the JWT locally:

    OCTOPUS_SSO_CLIENT_USER_TOKEN_SECRET=YOUR_TOKEN_SECRET
  3. Install the demo flavor:

    ./gradlew :sample:installDemoDebug

The demo flavor lets you pick a server and a sandbox API key; prod uses the production server.

The app's entry point is MainActivity.kt.

Since 1.15.0, the in-memory repositories in com.octopuscommunity.sdk.test.di.octopusTestModule keep created/deleted posts consistent across feeds, groups and profiles, separate connected users' feeds, and filter blocked authors from posts, featured comments, comments and replies. Fixtures include an unvoted poll, expandable text and video metadata (playback is not guaranteed). Repository seeds reuse the ids of MockPosts.default, withPoll, withClientObject, withComment, MockComments.default and MockReplies.default, but normalize their displayed state: read it from the repositories rather than assuming preview mocks are identical. Fetching other comment and reply feeds still generates items.

Next steps​