1
Create a new Android app in Android Studio
Choose the following options in the wizard.
2
Configure the AndroidManifest
Add the following to your
AndroidManifest.xml.3
Configure your dependencies
Add the following entries to the
:app build.gradle.kts file (ignore IDE
suggestion to move them to version catalog for now, if present).Ensure that you sync Gradle when all of the above is complete (Android
Studio should prompt you to do so).4
Add a Bijection backend
Open a terminal in your Android Studio instance and run
bijection init to
add a bijection/ folder, where you write your backend functions, with a
sample schema, query and mutation, and bijection.json.5
Start Bijection
Log this machine in to Bijection, once per machine, then start a Bijection
dev deployment. The first run of
bijection dev creates it and saves its
URL in .env.local as BIJECTION_URL; the command then keeps running to
push your functions on every change.Bijection’s hosted service is not yet open for public sign-up, and the CLI
has no default management service. Before running
bijection login, set
BIJECTION_MANAGEMENT_URL to the management service URL you were given, in
your shell’s startup file so that every later bijection command sees it too:6
Create a sample data for your database
Create a new
sampleData.jsonl file with these contents.7
Add the sample data to your database
Open another terminal tab and run.
8
Declare the tasks table
bijection init created bijection/schema.ts, which declares the tables of
your database, starting with a sample messages table. Add a tasks table
beside it. The schema gives your functions TypeScript types, and Bijection
enforces it at runtime.bijection/schema.ts
9
Expose a database query
Create a
tasks.ts file in your bijection/ directory with the following
contents.10
Create a data class
Add a new
data class to your MainActivity to support the task data
defined above. Import whatever it asks you to.11
Create your UI
Delete the template
@Composable functions that Android Studio created and
add a new one to display data from your Bijection deployment. Again, import
whatever it asks you to.12
Connect the app to your backend
- Get the deployment URL of your dev server with
cat .env.local | grep BIJECTION_URL - Add a
client: BijectionClientval and updateMainActivity.onCreateto use the@Composableyou just created.
13
Fix any missing imports
Fix up any missing imports (your import declarations should look something
like this):
14
Run the app
You can also try adding, updating or deleting documents in your
tasks
table at console.bijection.com - the app will update with the changes in
real-time.