This is a simple to-do list application demonstrating the use of the Kotlin Multiplatform SDK's Android package in an Android Kotlin project with Supabase.
To run this demo, you need a Supabase and PowerSync project. Detailed instructions for integrating PowerSync with Supabase can be found in the integration guide.
Follow this guide to:
- Create and configure a Supabase project.
- Create a new PowerSync instance, connecting to the database of the Supabase project. See instructions here.
- Deploy sync rules.
- Clone this repo:
git clone https://github.com/powersync-ja/powersync-kotlin.git
- Open
powersync-kotlin/demos/android-supabase-todolist
in Android Studio. - Sync the project with Gradle (this should happen automatically, or choose File > Sync project with Gradle Files).
- Insert your Supabase project URL, Supabase Anon Key, and PowerSync instance URL into the
local.properties
file:
# local.properties
sdk.dir=/path/to/android/sdk
# Enter your PowerSync instance URL
POWERSYNC_URL=https://foo.powersync.journeyapps.com
# Enter your Supabase project's URL and public anon key (Project settings > API)
SUPABASE_URL=https://foo.supabase.co
SUPABASE_ANON_KEY=foo
Choose a run configuration for the Android app in Android Studio and run it.
- Add
jitpack
as a repository to yoursettings.gradle.kts
so that the underlying android sqlite package can be downloaded:
dependencyResolutionManagement {
repositories {
maven("https://jitpack.io")
...
}
}
- Add the PowerSync SDK to your project by adding the following to your
build.gradle.kts
file:
dependencies {
implementation("com.powersync:core-android:$powersyncVersion")
...
}
If you want to use the Supabase Connector, also add the following to dependencies
:
dependencies {
implementation("com.powersync:connector-supabase:$powersyncVersion")
...
}