IssueReporterShakeManager

Turns a shake of the device into the issue reporter, for every activity in the app.

It is application-scoped on purpose. An app built on this toolkit has several activities, and copying a sensor listener into each of them would be the same code repeated per screen and a listener that outlives the screen that registered it. Only the foreground activity can present anything, so one listener that follows the resumed activity is all the feature needs.

The accelerometer is registered when an activity resumes and unregistered when it pauses, which is the platform's own guidance: a sensor left registered keeps drawing power with nothing to show for it. That also means a backgrounded app reads no sensor at all.

Nothing happens unless IssueReporterConfig.shakeToReportEnabled is set, and nothing happens until install is called, so a host that does not want the gesture never pays for it.

Parameters

application

The app whose activities are followed.

config

Host configuration deciding whether the gesture is active.

Constructors

Link copied to clipboard
constructor(application: Application, config: IssueReporterConfig)

Functions

Link copied to clipboard
fun install()

Starts following the app's activities.

Link copied to clipboard
open override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?)
Link copied to clipboard
open override fun onActivityDestroyed(activity: Activity)
Link copied to clipboard
open override fun onActivityPaused(activity: Activity)
Link copied to clipboard
open fun onActivityPostCreated(activity: Activity, savedInstanceState: Bundle?)
Link copied to clipboard
open fun onActivityPostDestroyed(activity: Activity)
Link copied to clipboard
open fun onActivityPostPaused(activity: Activity)
Link copied to clipboard
open fun onActivityPostResumed(activity: Activity)
Link copied to clipboard
open fun onActivityPostSaveInstanceState(activity: Activity, outState: Bundle)
Link copied to clipboard
open fun onActivityPostStarted(activity: Activity)
Link copied to clipboard
open fun onActivityPostStopped(activity: Activity)
Link copied to clipboard
open fun onActivityPreCreated(activity: Activity, savedInstanceState: Bundle?)
Link copied to clipboard
open fun onActivityPreDestroyed(activity: Activity)
Link copied to clipboard
open fun onActivityPrePaused(activity: Activity)
Link copied to clipboard
open fun onActivityPreResumed(activity: Activity)
Link copied to clipboard
open fun onActivityPreSaveInstanceState(activity: Activity, outState: Bundle)
Link copied to clipboard
open fun onActivityPreStarted(activity: Activity)
Link copied to clipboard
open fun onActivityPreStopped(activity: Activity)
Link copied to clipboard
open override fun onActivityResumed(activity: Activity)
Link copied to clipboard
open override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle)
Link copied to clipboard
open override fun onActivityStarted(activity: Activity)
Link copied to clipboard
open override fun onActivityStopped(activity: Activity)
Link copied to clipboard
fun uninstall()

Stops following activities and releases the sensor.