SliceMetrics

public class SliceMetrics
extends Object

java.lang.Object
   ↳ android.app.slice.SliceMetrics


Metrics interface for slices. This is called by SliceView, so Slice developers should not need to reference this class.

See also:

Summary

Public constructors

SliceMetrics(Context context, Uri uri)

An object to be used throughout the life of a slice to register events.

Public methods

void logHidden()

To be called whenever the slice becomes invisible to the user.

void logTouch(int actionType, Uri subSlice)

To be called whenever the user invokes a discrete action via a slice.

void logVisible()

To be called whenever the slice becomes visible to the user.

Inherited methods

Public constructors

SliceMetrics

Added in API level 28
public SliceMetrics (Context context, 
                Uri uri)

An object to be used throughout the life of a slice to register events.

Parameters
context Context: This value cannot be null.

uri Uri: This value cannot be null.

Public methods

logHidden

Added in API level 28
public void logHidden ()

To be called whenever the slice becomes invisible to the user.

logTouch

Added in API level 28
public void logTouch (int actionType, 
                Uri subSlice)

To be called whenever the user invokes a discrete action via a slice.

Use this for discrete events like a tap or the end of a drag, not for a continuous streams of events, such as the motion during a gesture.

Parameters
actionType int: The type of the event.

subSlice Uri: The URI of the sub-slice that is the subject of the interaction. This value cannot be null.

logVisible

Added in API level 28
public void logVisible ()

To be called whenever the slice becomes visible to the user.