WormaCeptor

Launching the UI

Different ways to open the WormaCeptor UI in your app.

Via Intent

Launch WormaCeptor manually from a button, menu item, or any trigger:

startActivity(WormaCeptorApi.getLaunchIntent(context))

Via Shake Gesture

Register a lifecycle-aware shake detector that opens WormaCeptor when the user shakes the device:

MainActivity.kt
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // ...
        WormaCeptorApi.startActivityOnShake(this)
    }
}

The shake detector automatically stops when the activity is destroyed.

Via Floating Button

Show a draggable floating button overlay that opens WormaCeptor when tapped:

// Check permission first
if (WormaCeptorApi.canShowFloatingButton(context)) {
    WormaCeptorApi.showFloatingButton(context)
} else {
    // Request overlay permission
    val intent = WormaCeptorApi.getOverlayPermissionIntent(context)
    if (intent != null) {
        startActivity(intent)
    }
}

// Hide when no longer needed
WormaCeptorApi.hideFloatingButton(context)

Floating Button Methods

MethodReturnDescription
canShowFloatingButton(context)BooleanCheck if overlay permission is granted (always true on API < 23)
showFloatingButton(context)BooleanShow overlay. Returns false if permission not granted
hideFloatingButton(context)UnitHide the overlay
getOverlayPermissionIntent(context)Intent?Intent to open system overlay permission settings

On this page