Brifing

KMP Starter Kit: Firebase and AI Integrations

Enhance your mobile app with online features.

ProAndroidDev - Medium3 min

1Integration Phase of KMP Starter Kit

The second phase of the KMP Starter Kit focuses on integrating your app with Firebase and AI services. This stage is only necessary if your app requires online features. For example, syncing user data across devices or securely using AI APIs requires these integrations. Otherwise, for apps that work entirely offline, this phase can be skipped.

2Three Key Reasons for Integration

There are three main reasons to integrate your app with online services: Authentication (like Sign in with Google or Apple) prevents data loss when users switch devices. A backend proxy is needed to securely use AI APIs without exposing keys. Crash reports help you identify bugs before users complain. If none of these apply to your app, you can skip the integration phase.

3Configuration Files

The KMP Starter Kit manages all configurations in three main files: AppConfiguration.kt contains general settings like Firebase URL, social login options, and privacy policy links. local.properties stores secrets like API keys and client IDs, protected by gitignore. gradle.properties determines the subscription provider (Adapty or RevenueCat). These files make the integration process transparent and manageable.

4Firebase Integration

Firebase provides ready-to-use backend services like user accounts, crash reports, and analytics. The KMP Starter Kit offers a step-by-step guide for Firebase integration: Create a project in the Firebase console, register your Android and iOS apps, obtain the SHA-1 fingerprint, and place the config files in the correct directories. Enable anonymous and optional social logins in the Authentication section. The AI assistant guides you through each step.

5Anonymous and Social Login

The KMP Starter Kit enables anonymous login by default, allowing users to start using the app without creating an account. Later, they can link a real account (Google or Apple) without losing data. To enable social logins, set AUTH_SOCIAL_LOGIN_ENABLED = true in AppConfiguration.kt and activate the methods in the Firebase console. The kit includes pre-built screens and logic for these features.

6Backend Proxy for AI Features

Apps with AI features need a backend proxy to secure API keys. The KMP Starter Kit provides a ready-to-use backend on Firebase. This backend authenticates users and forwards requests to services like OpenAI or Replicate. Store your API keys in Google Secret Manager to keep them secure and out of your app code. This ensures your keys remain private and protected.

7Integration Check

The KMP Starter Kit includes a script to check your integration setup: ./MobileApp/scripts/check_env.sh --phase integrations. This command prints a checklist highlighting missing configurations. Your AI assistant also runs this command to guide you. For example, you can say, 'I am in the integration phase, integrating Firebase, guide me,' and follow the steps provided.

8Conclusion and Recommendations

The integration phase of the KMP Starter Kit empowers your app with online features. You can add user management and crash reports with Firebase, or use a secure backend proxy for AI features. However, these are only necessary if your app requires them. For fully offline apps, you can skip this phase and proceed directly to publishing or monetization. The KMP Starter Kit's flexible structure adapts to your project's needs.

Original article: ProAndroidDev - Medium — KMP Starter Kit ile Firebase ve AI Entegrasyonu