Docs

Built for your developers.

The mobile SDK puts the Instaread player in your iOS, Android, React Native and Flutter apps today. The REST API and MCP server are coming soon.

Just want the player on your site? That’s the integrations guide →

Mobile SDK

Embed the Instaread Audio Player on top of relevant articles in your app, with background playback, lock-screen controls and a floating mini player. Pick your platform.

Use the latest version: for the best integration, always use the latest version of the SDK. Check the package page for the newest release: npm.

Requirements: React Native 0.76 or newer, on either architecture. One package covers both platforms. The native iOS and Android SDKs are bundled within it.

  1. 1

    Install the package

    Install the SDK from npm, then install the iOS pods.

    Terminal
    npm install @instaread-co/react-native-instaread-sdk
    cd ios && pod install
  2. 2

    Platform-specific setup

    These are the platform-specific edits in the entire integration.

    iOS

    To enable background audio playback (so that audio continues playing when the app is in the background or the screen is locked), add the following configuration to your Info.plist:

    ios/YourApp/Info.plist
    <key>UIBackgroundModes</key>
    <array>
        <string>audio</string>
    </array>

    Android

    A. Add the native SDK to your build by including the following line in the dependencies in android/app/build.gradle:

    android/app/build.gradle
    implementation files("$rootDir/../node_modules/@instaread-co/react-native-instaread-sdk/android/libs/instaread-sdk.aar")

    Android does not automatically include a library’s local .aar file in the app. This line ensures that the player is included in your build.

    B. Request notification permission on Android 13 and above. Without this permission, the lock-screen media controls will not appear.

    App.tsx
    import { PermissionsAndroid, Platform } from 'react-native';
    
    if (Platform.OS === 'android' && Platform.Version >= 33) {
      PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
    }
  3. 3

    Configure the SDK once at your app’s root

    Same code on iOS and Android. Replace yourslug with your Instaread publication name.

    App.tsx
    import { InstareadPlayer } from '@instaread-co/react-native-instaread-sdk';
    
    // Before anything renders — e.g. at the top of App.tsx
    InstareadPlayer.configure('yourslug');
  4. 4

    Add the player to your article screen

    We recommend placing it at the top, so that the audio player appears immediately after the article heading and before the article text.

    ArticleScreen.tsx
    import { InstareadPlayerView } from '@instaread-co/react-native-instaread-sdk';
    
    <InstareadPlayerView articleUrl={article.canonicalUrl} />

    Important: please ensure that articleUrl points to the article’s own page URL on your site, which is the same URL used by the web player.

That’s the whole integration. The player sizes itself, and the mini player appears on its own. Everything below is optional.

Reference

Configuration options and functions, for when you need more than the basics.

Configuration options

All configuration options are optional. When a value is not provided, the SDK uses your publication’s configured setting, followed by the SDK default.

All options
InstareadPlayer.configure('yourslug', {
  miniPlayerEnabled: true,
  miniPlayerBottomOffset: 49,
  playerType: 'compact',
  dark: true,
  singlePlayerMode: true,
});
miniPlayerEnabled
Controls whether the floating mini player is displayed.Default: true
miniPlayerBottomOffset
The height of your app’s bottom UI, so the mini player can be positioned above it. See Mini player position.Default: 50
playerType
The inline player design: acoustic, compact or rectangular. See Player designs.Default: acoustic
dark
Enables the dark player theme.Default: false
singlePlayerMode
For apps with their own audio player. If only one player should be on screen at a time, set it to true and use onPlaybackStarted and stop(), as shown in Only if your app has its own audio player. To keep both players, leave it out and set miniPlayerBottomOffset high enough that the Instaread mini player sits above yours.Default: false
Functions

This is the whole public API. There is no client instance to create or pass between screens.

InstareadPlayer.configure(slug, options?)
Call once at app start with your publication name and any options. Calling it again replaces the whole configuration, so pass every option you use each time.
<InstareadPlayerView articleUrl />
The inline player for one article. It manages its own height: zero while there is nothing to display, a loading state while loading, then the player.
InstareadPlayer.onPlaybackStarted
Called when the Instaread player starts playing, so you can pause or close your own player. Requires singlePlayerMode.
InstareadPlayer.stop()
Closes the Instaread mini player. Call it when your own audio starts playing. Requires singlePlayerMode.
Mini player position

Use miniPlayerBottomOffset to move the mini player up, so it sits above your app’s bottom bar. If you leave it out, it defaults to 50, in the same units as your React Native styles (points on iOS, dp on Android).

Mini player offset
InstareadPlayer.configure('yourslug', { miniPlayerBottomOffset: 49 });
Only if your app has its own audio player

If your app plays its own audio and the two players should never play simultaneously, enable single-player mode and connect the handoff between the two players.

Single-player mode
InstareadPlayer.configure('yourslug', { singlePlayerMode: true });

// Instaread started playing → pause or close your player
InstareadPlayer.onPlaybackStarted = () => {
  myPlayer.pause();
};

// Your player started playing → close Instaread's mini player
myPlayer.onStartedPlaying(() => {
  InstareadPlayer.stop();
});

Connect stop() to the event where your own audio actually begins playing, not only to your Play button. Playback can also start from a full-screen player, a track list or the lock screen.

Want to keep both players on screen instead? Leave singlePlayerMode out and set miniPlayerBottomOffset high enough that the Instaread mini player sits above your own player.

Player designs

Select a design using the playerType configuration: 'acoustic', 'compact' or 'rectangular'.

Acoustic is the default. See all three live in the design studio →

For custom designs, please contact us →

Additional resources

Usage, configuration options and troubleshooting are also available on the package page: @instaread-co/react-native-instaread-sdk on npm →

Questions about your integration? Talk to us →