A Kotlin SDK for integrating with the YouVersion Platform, enabling developers to display Scripture content and implement user authentication in any Android environment. Multiplatform support is currently not available.
- Features
- Requirements
- Installation
- Getting Started
- Usage
- Sample App
- For Different Use Cases
- Contributing
- Documentation
- Support
- License
- π Scripture Display - Easy-to-use Jetpack Compose components for displaying Bible verses, chapters, and passages with
BibleText - π User Authentication - Seamless "Sign In with YouVersion" integration using
SignInWithYouVersionButton - π
Verse of the Day - Built-in
VerseOfTheDaycomponent and API access to VOTD data - π Modern Kotlin - Built with coroutines, Jetpack Compose, and Material Theming
- πΎ Smart Caching - Automatic local caching for improved performance
- Android 5.0+
- Android Studio Narwhal+
- Kotlin 2.2.0+
- A YouVersion Platform API key (Register here)
Be sure you have mavenCentral() in your repositories block.
// settings.gradle.kts
repositories {
google()
mavenCentral()
}The Platform SDK is broken into three main modules:
platform-core: Provides the core functionality for accessing the YouVersion Platform API.platform-ui: Provides UI components for displaying Bible content.platform-reader: Provides a full Bible Reader experience.
I want to only access the Bible API's and build my own integrations
You will only need platform-core.
I want to display Bible content or authenticate with YouVersion in my app but with my own styling
You will need platform-ui and platform-core.
I want a full, batteries included, drop-in Bible Reader experience
You will need platform-reader, platform-ui, and platform-core.
Great! Now that you know which modules you need, you can proceed with installation.
# gradle/libs.versions.toml
[versions]
youVersionPlatform = "0.7.1"
[libraries]
youversion-platform-core = { module = "com.youversion.platform:platform-sdk-core", version.ref = "youVersionPlatform" }
youversion-platform-ui = { module = "com.youversion.platform:platform-sdk-ui", version.ref = "youVersionPlatform" }
youversion-platform-reader = { module = "com.youversion.platform:platform-sdk-reader", version.ref = "youVersionPlatform" }// app/build.gradle.kts
implementation(libs.youversion.platform.core)
implementation(libs.youversion.platform.ui)
implementation(libs.youversion.platform.reader)val youVersionPlatform = "0.7.1"
implementation("com.youversion.platform:platform-core:$youVersionPlatform")
implementation("com.youversion.platform:platform-ui:$youVersionPlatform")
implementation("com.youversion.platform:platform-reader:$youVersionPlatform")- Get Your API Key: Register your app with YouVersion Platform to acquire an app key
- Configure the SDK: Add the following to your app's initialization:
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
YouVersionPlatformConfiguration.configure(
context = this,
appKey = TODO("YOUR_APP_KEY_HERE"),
)
}
}Display a single verse:
@Composable
fun Demo() {
BibleText(
reference = BibleReference(versionId = 3034, bookUSFM = "JHN", chapter = 3, verse = 16)
)
}Display a verse range:
@Composable
fun Demo() {
BibleText(
reference = BibleReference(versionId = 3034, bookUSFM = "JHN", chapter = 3, verseStart = 16, verseEnd = 20)
)
}Or display a full chapter:
@Composable
fun Demo() {
BibleText(
reference = BibleReference(versionId = 3034, bookUSFM = "JHN", chapter = 3)
)
}Note: For longer passages, wrap
BibleTextin averticalScroll. The SDK automatically fetches Scripture from YouVersion servers and maintains a local cache for improved performance.
Use the built-in VOTD component:
@Composable
fun Demo() {
CompactVerseOfTheDay()
// Or
VerseOfTheDay()
}Or fetch VOTD data for custom UI:
suspend fun fetchVotd(): YouVersionVerseOfTheDay {
val dayOfTheYear = Calendar.getInstance().get(Calendar.DAY_OF_YEAR)
return YouVersionApi.votd.verseOfTheDay(dayOfTheYear)
}Integrating "Sign In with YouVersion" is straightforward. The SDK handles the entire authentication flow, including launching the sign-in screen, handling the redirect, and managing tokens.
To handle the redirect from the YouVersion authentication, you need to add an intent filter to your main activity in your AndroidManifest.xml file. The SDK will use this to receive the authentication result.
<!-- AndroidManifest.xml -->
<activity
android:name=".MainActivity"
android:exported="true">
<!-- ... existing intent filters -->
<!-- Handle OAuth callback -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="youversionauth"
android:host="callback" />
</intent-filter>
</activity>Your main activity must extend SignInWithYouVersionActivity. This allows the SDK to automatically handle the result from the sign-in process.
// MainActivity.kt
import com.youversion.platform.ui.signin.SignInWithYouVersionActivity
class MainActivity : SignInWithYouVersionActivity() {
// ...
}Use the SignInWithYouVersionButton composable in your UI. You can use the SignInViewModel to check if the user is already signed in and conditionally display the button.
SignInWithYouVersionPermission.PROFILE: To access the user's name and profile picture.SignInWithYouVersionPermission.EMAIL: To access the user's email address.
// ProfileScreen.kt
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import com.youversion.platform.core.users.model.SignInWithYouVersionPermission
import com.youversion.platform.ui.signin.SignInViewModel
import com.youversion.platform.ui.views.SignInWithYouVersionButton
@Composable
fun ProfileScreen() {
val signInViewModel = viewModel<SignInViewModel>()
val state by signInViewModel.state.collectAsStateWithLifecycle()
if (state.isSignedIn) {
Column {
Text("Welcome, ${state.userName ?: "User"}!")
Text("Your email is ${state.userEmail ?: "not available"}.")
Spacer(modifier = Modifier.height(16.dp))
Button(onClick = { signInViewModel.onAction(SignInViewModel.Action.SignOut()) }) {
Text("Sign Out")
}
}
} else {
SignInWithYouVersionButton(
permissions = {
setOf(
SignInWithYouVersionPermission.PROFILE,
SignInWithYouVersionPermission.EMAIL
)
}
)
}
}That's it. The SignInViewModel will automatically update its state, and your UI will recompose to reflect the user's authentication status.
Explore the examples directory for a complete sample app demonstrating:
- Scripture display with various reference types
- User authentication flows
- VOTD integration
- Best practices for token storage
To run the sample app:
- Open the
platform-sdk-kotlindirectory in Android Studio - Wait for Gradle sync to complete (File β Sync Project with Gradle Files if needed)
- Add your API key to
examples/sample-android/src/main/java/com/youversion/platform/MainApplication.kt - Select
sample-androidfrom the run configuration dropdown - Create an emulator if needed (Tools β Device Manager β Create Device)
- Click Run
Building an Android application? This Kotlin SDK provides native Jetpack Compose components including BibleText, VerseOfTheDay, and SignInWithYouVersionButton using modern language features.
Need direct access to YouVersion Platform APIs? See our comprehensive API documentation for advanced integration patterns and REST endpoints.
Building AI applications with Bible content? Access YouVersion's LLM-optimized endpoints and structured data designed for language models. See our LLM documentation for details.
See CONTRIBUTING.md for details on how to get started.
- API Documentation - Complete API reference
- LLM Integration Guide - AI/ML integration docs
- Release Process - Contribution and release guidelines
- Sample Code - Working examples and best practices
- Issues: GitHub Issues
- Questions: Open a discussion
- Platform Support: YouVersion Platform
This SDK is licensed under the Apache License 2.0. See LICENSE for details.
Made with β€οΈ by YouVersion
