Provider

Creating a provider#

This guide assumes you've already configured a TestProvider module in the providers folder and added it to settings.gradle.kts.

The recommended architecture is capability-based:

  • Your entry class extends ProviderPlugin.
  • You expose one or more capability APIs (search, catalogs, metadata, links, etc.).

ProviderApi and getApi() still exist for backward compatibility, but they’re deprecated.

Provider project structure#

As noted in the "Creating a custom provider" step, your project structure follows a standard Kotlin/Java Gradle module setup:

TestProvider/
├── build.gradle.kts            # Provider-specific build configuration
├── src/
│   └── main/
│       ├── kotlin/             # Your provider's source code
│       │   └── com/
│       │       └── example/
│       │           └── testProvider/
│       │               └── TestProvider.kt
│       └── res/                # Resources (if needed)
└── README.md                   # Provider-specific documentation (optional)

Ensure that the TestProvider project—or any provider you create—follows this structure within the providers folder.

The package hierarchy inside the source set folder (src/main/kotlin or src/main/java) doesn't need to match exactly, but the build.gradle.kts file and source set folder should always be present.

Creating the entry class (ProviderPlugin)#

The provider entry class is what the app loads at runtime.

The core stubs library is well-documented — hover any symbol from core-stubs to read its KDoc.

To create a new provider entry class:

Create a new class that extends ProviderPlugin#

Every ProviderPlugin class must be annotated with the FlixclusiveProvider annotation!

import com.flixclusive.provider.FlixclusiveProvider
import com.flixclusive.provider.ProviderPlugin
// ...
 
@FlixclusiveProvider
class TestProvider : ProviderPlugin() {
    // ...
}

Expose capability APIs via getters#

Capability getters should return stable instances (cache via by lazy).

manifest and settings are initialized by the host app. Avoid reading them in property initializers or init {} blocks. Prefer by lazy { ... } so the values are accessed only when needed.

import android.content.Context
import com.flixclusive.provider.ProviderPlugin
import com.flixclusive.provider.capability.SearchProviderApi
import com.flixclusive.provider.capability.MediaLinkProviderApi
// ...
 
class TestProvider : ProviderPlugin() {
    private val searchApi by lazy {
        TestProviderSearchProviderApi(
            providerId = manifest.id,
        )
    }
 
    private val mediaLinkApi by lazy {
        TestProviderMediaLinkProviderApi(
            providerId = manifest.id,
        )
    }
 
    override fun getSearchApi(context: Context): SearchProviderApi = searchApi
 
    override fun getMediaLinkApi(context: Context): MediaLinkProviderApi = mediaLinkApi
}

For detailed signatures, see the ProviderPlugin API reference.

Implementing the capability APIs#

Each capability is a focused interface. Implement only what your provider supports.

CapabilityGuide
SearchGuide
CatalogsGuide
MetadataGuide
Media linksGuide
Cross-matchGuide
TrackerGuide
Settings UIGuide
FiltersGuide

Optional: legacy ProviderApi#

ProviderApi can still be used (and some older examples still reference it), but it is deprecated. Prefer capability APIs for new providers.

Final output#

At runtime, your provider should appear in the app’s provider list.

Lastly, deploy the provider to the app using the following command:

If you are developing using the release or pre-release version of the app, run the following command:

./gradlew :TestProvider:deployWithAdb

After successful deployment, your provider should appear in the app's provider list.

Test provider card preview