Android quickstart
dev.mushimushi:mushi-android ships shake detection (via SensorManager), a
bottom-sheet capture UI, a file-backed offline queue, rage-tap and slow-screen
detection, and an optional Sentry bridge.
Preview, not on Maven Central yet. A dependencies { implementation(…) }
line alone will not resolve until the first release is published. Until then,
build the library from the repository and consume it from your local Maven
repository, as below. npx mushi-mushi does not set up native Android projects.
Get your project ID and API key
The SDK needs two values from a Mushi Mushi project.
- By hand: create a free account
(no card) and create a project. The panel that opens shows the project ID
and an API key that starts with
mushi_. Copy the key now: it is shown once. You can mint another under Set up → Test it → Generate API key. - Self-hosting? Your own console gives you the same two values. See Self-hosting.
They go into the config in the Initialize step below.
Build from source
The library lives in packages/android
and has no Gradle wrapper checked in. CI builds it with Gradle 8.9 and JDK 17;
use the same versions, plus the Android SDK.
git clone https://github.com/kensaurus/mushi-mushi.git
cd mushi-mushi/packages/android
gradle publishToMavenLocalThen add mavenLocal() to your app’s repositories and depend on the version
from packages/android/build.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
mavenLocal() // preview build of dev.mushimushi:mushi-android
}
}dependencies {
implementation("dev.mushimushi:mushi-android:0.4.0")
}CI only runs gradle assembleRelease on this module, so the local publish is
the less-travelled path. If it fails for you, gradle assembleRelease builds
build/outputs/aar/mushi-android-release.aar; add that file as a dependency
together with the libraries it needs (androidx.core:core-ktx,
androidx.appcompat:appcompat, androidx.fragment:fragment-ktx,
com.squareup.okhttp3:okhttp, com.google.code.gson:gson).
Initialize
endpoint is required: use the hosted API below, or your own if you self-host.
import android.app.Application
import dev.mushimushi.sdk.Mushi
import dev.mushimushi.sdk.config.MushiConfig
import dev.mushimushi.sdk.config.TriggerMode
class App : Application() {
override fun onCreate() {
super.onCreate()
Mushi.init(this, MushiConfig(
projectId = "YOUR_PROJECT_ID",
apiKey = "mushi_...",
endpoint = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api",
triggerMode = TriggerMode.BOTH, // SHAKE | BUTTON | BOTH | NONE
))
}
}<application
android:name=".App"
...>
<!-- ... -->
</application>Open the widget or submit a report
The bottom sheet needs the current activity to be a FragmentActivity
(for example AppCompatActivity).
// Present the bottom-sheet widget
button.setOnClickListener { Mushi.showWidget() }
// File a report from code, no UI
Mushi.report(
description = "Search results sometimes appear twice.",
category = "bug",
)
// Forward a caught error
try { riskyOperation() } catch (t: Throwable) { Mushi.captureError(t) }Sentry bridge (optional)
With io.sentry:sentry-android on the classpath, call
MushiSentryBridge.install() (from dev.mushimushi.sdk.sentry) after
initialising Sentry. It resolves Sentry by reflection and does nothing when
Sentry is absent.
Full API: dev.mushimushi:mushi-android.