android-firebase
Firebase integration patterns for Android - Crashlytics, Analytics, Remote Config, FCM. Use when setting up crash reporting, analytics events, remote configuration, or push notifications.
Best use case
android-firebase is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Firebase integration patterns for Android - Crashlytics, Analytics, Remote Config, FCM. Use when setting up crash reporting, analytics events, remote configuration, or push notifications.
Teams using android-firebase should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/android-firebase/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How android-firebase Compares
| Feature / Agent | android-firebase | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Firebase integration patterns for Android - Crashlytics, Analytics, Remote Config, FCM. Use when setting up crash reporting, analytics events, remote configuration, or push notifications.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Android Firebase Skill
Firebase integration patterns: Crashlytics, Analytics, Remote Config, FCM.
## When to Use
- Setting up Firebase SDK
- Implementing crash reporting
- Adding analytics events
- Using Remote Config
- Setting up FCM (Push Notifications)
## Setup
### Dependencies
```toml
[versions]
firebase-bom = "33.8.0"
[libraries]
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx" }
firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-ktx" }
firebase-config = { module = "com.google.firebase:firebase-config-ktx" }
firebase-messaging = { module = "com.google.firebase:firebase-messaging-ktx" }
```
### Initialization
```kotlin
// In Application class
FirebaseApp.initializeApp(this)
```
## Crashlytics
```kotlin
// Log non-fatal exception
Firebase.crashlytics.recordException(exception)
// Custom keys for debugging
Firebase.crashlytics.setCustomKey("user_id", userId)
Firebase.crashlytics.setCustomKey("screen", currentScreen)
// Log message
Firebase.crashlytics.log("User clicked purchase button")
// Set user identifier
Firebase.crashlytics.setUserId(userId)
// Force crash (for testing)
throw RuntimeException("Test Crash")
```
## Analytics
```kotlin
// Log standard event
Firebase.analytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM) {
param(FirebaseAnalytics.Param.ITEM_ID, itemId)
param(FirebaseAnalytics.Param.ITEM_NAME, itemName)
}
// Custom event
Firebase.analytics.logEvent("game_completed") {
param("score", finalScore.toLong())
param("level", currentLevel.toLong())
param("time_spent", timeInSeconds.toLong())
}
// Screen tracking
Firebase.analytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW) {
param(FirebaseAnalytics.Param.SCREEN_NAME, screenName)
param(FirebaseAnalytics.Param.SCREEN_CLASS, screenClass)
}
// User properties
Firebase.analytics.setUserProperty("premium_user", "true")
Firebase.analytics.setUserId(userId)
```
## Remote Config
```kotlin
val remoteConfig = Firebase.remoteConfig
remoteConfig.setConfigSettingsAsync(remoteConfigSettings {
minimumFetchIntervalInSeconds = 3600 // 1 hour
})
// Set defaults
remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)
// Fetch and activate
remoteConfig.fetchAndActivate().addOnCompleteListener { task ->
if (task.isSuccessful) {
val featureEnabled = remoteConfig.getBoolean("new_feature_enabled")
val welcomeMessage = remoteConfig.getString("welcome_message")
val maxRetries = remoteConfig.getLong("max_retries")
}
}
// Real-time config (auto-update)
remoteConfig.addOnConfigUpdateListener(object : ConfigUpdateListener {
override fun onUpdate(configUpdate: ConfigUpdate) {
remoteConfig.activate()
}
override fun onError(error: FirebaseRemoteConfigException) {}
})
```
## FCM (Push Notifications)
```kotlin
class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onNewToken(token: String) {
// Send token to server
sendTokenToServer(token)
}
override fun onMessageReceived(message: RemoteMessage) {
// Handle notification
message.notification?.let { notification ->
showNotification(notification.title, notification.body)
}
// Handle data payload
message.data.let { data ->
handleDataPayload(data)
}
}
}
// Get current token
Firebase.messaging.token.addOnCompleteListener { task ->
if (task.isSuccessful) {
val token = task.result
}
}
// Subscribe to topic
Firebase.messaging.subscribeToTopic("news")
```
## Version Compatibility
| Firebase BOM | Min SDK | Compile SDK |
|--------------|---------|-------------|
| 33.8.0 | 21 | 35 |
| 33.0.0 | 21 | 34 |
| 32.0.0 | 19 | 33 |
## Error Handling
```kotlin
// Remote Config error handling
remoteConfig.fetchAndActivate()
.addOnSuccessListener { activated ->
if (activated) Timber.d("Config activated")
else Timber.d("Config already up to date")
}
.addOnFailureListener { e ->
when (e) {
is FirebaseRemoteConfigException ->
Timber.w("Remote config fetch failed: ${e.code}")
else -> Timber.e("Unexpected error: ${e.message}")
}
// Use cached/default values
}
// Crashlytics non-fatal reporting
try {
riskyOperation()
} catch (e: Exception) {
Firebase.crashlytics.recordException(e)
// Handle gracefully
}
```
## Troubleshooting
| Issue | Solution |
|-------|----------|
| Events not showing | Wait 24h or use DebugView |
| Crashes not reporting | Check google-services.json |
| FCM not receiving | Verify token registration |
| Config not updating | Check fetch interval |
## Security Checklist
- [ ] Disable Crashlytics in debug builds (optional)
- [ ] No PII in crash logs or analytics
- [ ] Validate FCM token before use
- [ ] Use App Check for backend protection
- [ ] Review analytics data retention settings
## Best Practices
- Enable Crashlytics in release builds only
- Use custom events sparingly (500 limit per app)
- Cache Remote Config values locally
- Handle FCM token refresh
- Set user ID consistently across services
- Use DebugView for testing analytics
## References
- [Firebase Android Setup](https://firebase.google.com/docs/android/setup)
- [Crashlytics](https://firebase.google.com/docs/crashlytics)
- [Analytics](https://firebase.google.com/docs/analytics)
- [Remote Config](https://firebase.google.com/docs/remote-config)
- [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging)
Use Firebase for robust analytics and crash reporting.Related Skills
android
Build, review, and refactor Android mobile apps (Kotlin) using modern Android patterns. Use for tasks like setting up Gradle modules, Jetpack Compose UI, navigation, ViewModel/state management, networking (Retrofit/OkHttp), persistence (Room/DataStore), DI (Hilt/Koin), testing, performance, release builds, and Play Store readiness.
android-watch-logs
Start real-time log streaming from connected Android device using adb logcat. Shows only app's log messages. Use when monitoring app behavior, debugging, or viewing Android logs.
android-use
Control Android devices via ADB commands - tap, swipe, type, navigate apps
android-supabase
Supabase integration patterns for Android - authentication, database, realtime subscriptions. Use when setting up Supabase SDK, implementing OAuth, querying database, or setting up realtime.
android-stop-app
Stop the Android app running on connected device. Cleanly terminates the app using force-stop. Use when stopping the app for debugging, testing, or cleanup.
android-project
Navigate and analyze Android project structure, modules, and dependencies. Use when exploring project structure, finding related files, analyzing dependencies, or locating code patterns.
android-notification-builder
Эксперт Android notifications. Используй для push notifications, channels и notification patterns.
android-motion-specialist
Expert Android developer for the Motion Detector project. Use this skill when working on Camera2 API integration, motion detection algorithms, Android networking (LAN sockets + Supabase Realtime), debugging crashes, or any Android/Kotlin development tasks specific to this sprint timing application.
android-kotlin
Android Kotlin development with Coroutines, Jetpack Compose, Hilt, and MockK testing
android-kotlin-development
Develop native Android apps with Kotlin. Covers MVVM with Jetpack, Compose for modern UI, Retrofit for API calls, Room for local storage, and navigation architecture.
android-keystore-generation
Generate production and local development keystores for Android release signing
android-gradle
Automate Gradle tasks for Android projects - build, test, coverage, clean. Use when building APKs, running unit tests, generating coverage reports, or checking dependencies.