DEV Community

JP Origin
JP Origin

Posted on

I built an on-device overlay to debug Firebase Analytics events (no cable, no logcat)

The problem

Checking analytics events on Android usually means plugging in a cable, filtering logcat, or setting up Firebase DebugView. Testers can't easily do that on their own phones, so wrong events (bad names, too many params) often get found after release.

What Event Box does

Event Box is a small open-source library. A floating bubble sits on top of your app. Tap it and a panel shows events as they fire: number, time, name and params. Think of it as Firebase DebugView on the device itself.

Event Box demo

  • ⚠ Firebase limit warnings: any event that breaks a rule (event name length, param count, value length, user property limits) gets a warning icon, and tapping it shows the exact reason.
  • Resizable, pinnable panel: draggable, snaps to the screen edge, shows an unread badge.
  • Background overlay mode (opt-in): stays visible in recents (needs SYSTEM_ALERT_WINDOW in your debug manifest).
  • Safe by design: a kill switch, timed sessions that end by themselves, and logging that never throws into your app.
  • Kotlin and Java, minSdk 21, ships its own R8 rules, and events are exposed as StateFlow.

Setup

implementation("com.github.JpOriginDev:event-box:1.3.0")  // via JitPack
Enter fullscreen mode Exit fullscreen mode
// Application.onCreate()
OGEventBoxLog.setDebugModeEnabled(BuildConfig.DEBUG)
    .setDebugModeDurationHours(0.5)
    .install(this)

// somewhere in your app (hidden gesture, debug menu)
OGEventBoxLog.setEnabled(context, true)

OGEventBoxLog.log("purchase", bundle)
Enter fullscreen mode Exit fullscreen mode

One-call wrapper (no double logging)

Instead of calling OGEventBoxLog.log() next to every analytics call, wrap your SDK once. It has no analytics dependency of its own, so it works with Firebase, Amplitude, Mixpanel or anything else:

val analytics = OGEventBoxAnalytics.wrap(
    eventSink = { name, params -> firebaseAnalytics.logEvent(name, params) },
    userPropertySink = { name, value -> firebaseAnalytics.setUserProperty(name, value) }
)

analytics.logEvent("purchase", bundle)
Enter fullscreen mode Exit fullscreen mode

The event goes to Event Box first (it never throws), then to your SDK. While the box is off, only your SDK call runs.

Honest limitations

  • The Firebase checks are best-effort and may lag behind rule changes.
  • No search or export yet.
  • It is not a no-op in release builds. The panel shows event names and params on screen, which may include user data, so gate it with BuildConfig.DEBUG.
  • The background overlay only lasts while Android keeps your process alive.

Feedback I'd love

  1. Would you use this, and what would stop you?
  2. Is the wrapper approach the right way to avoid double calls, or would you prefer something else?
  3. Search/filter and "share log as text" are next. Is anything more important?

Links

Top comments (0)