FirebaseUserActions
Stay organized with collections
Save and categorize content based on your preferences.
Provides methods for logging actions that the user takes in the app.
This is a simple example for logging that the user has started to view an article:
FirebaseUserActions.getInstance(getApplicationContext()).start(
Actions.newView(
"Index your app with Google App Indexing",
"//example.net/articles/02101984.html"));
Public Constructor Summary
Public Method Summary
abstract Task<Void>
|
end( Action
action)
Logs that the user has stopped doing something in the app.
|
synchronized static FirebaseUserActions
|
|
abstract Task<Void>
|
start( Action
action)
Logs that the user has started doing something in the app.
|
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Constants
public static final String
APP_INDEXING_API_TAG
The tag used for logging debug information for calls to FirebaseUserActions
class.
To enable logging:
adb shell setprop log.tag.FirebaseUserActions DEBUG
Constant Value:
"FirebaseUserActions"
Public Constructors
public FirebaseUserActions ()
Public Methods
public abstract Task<Void> end (Action
action)
Logs that the user has stopped doing something in the app.
Use this method for a user action of some duration that has come to an end, like
when the user has finished viewing an article or stopped listening to a song, as well
as for instantaneous actions the user has taken, such as sending a message or adding a
song to a playlist. For these instantaneous actions, don't call
start(Action)
at all, but just
end(Action)
.
Parameters
action |
The Action
describing either the instantaneous action the user has just taken, or the more
long-lived activity the user has stopped doing in the app; for the latter
start(Action) should be called before calling
end(Action) . |
Returns
- A
Task
indicating the result of the operation.
Returns an instance of FirebaseUserActions
.
This method does not require FirebaseApp initialization. Instead, the application
context is inferred from the context
that is explicitly passed in.
public abstract Task<Void> start (Action
action)
Logs that the user has started doing something in the app.
Use this method for a user action of some duration, like viewing an article or
listening to a song. If the action is instantaneous, such as sending a message or
adding a song to a playlist, then make a single call to
end(Action)
instead.
Parameters
action |
The Action
describing what the user has started doing in the app. |
Returns
- A
Task
indicating the result of the operation.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-05-11 UTC.
[null,null,["Last updated 2021-05-11 UTC."],[],[],null,["public abstract class **FirebaseUserActions** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nProvides methods for logging actions that the user takes in the app.\n\nThis is a simple example for logging that the user has started to view an article: \n\n FirebaseUserActions.getInstance(getApplicationContext()).start(\n Actions.newView(\n \"Index your app with Google App Indexing\",\n \"//example.net/articles/02101984.html\"));\n \nConstant Summary\n\nPublic Constructor Summary\n\nPublic Method Summary\n\nInherited Method Summary \nFrom class java.lang.Object \n\nConstants \n\npublic static final [String](//developer.android.com/reference/java/lang/String.html)\n**APP_INDEXING_API_TAG** \nThe tag used for logging debug information for calls to [FirebaseUserActions](/docs/reference/android/com/google/firebase/appindexing/FirebaseUserActions)\nclass.\n\nTo enable logging: \n\n`adb shell setprop `*log.tag.FirebaseUserActions*` `*DEBUG* \nConstant Value: \"FirebaseUserActions\"\n\nPublic Constructors \n\npublic **FirebaseUserActions** () \n\nPublic Methods \n\npublic abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **end** ([Action](/docs/reference/android/com/google/firebase/appindexing/Action) action) \nLogs that the user has stopped doing something in the app.\n\nUse this method for a user action of some duration that has come to an end, like\nwhen the user has finished viewing an article or stopped listening to a song, as well\nas for instantaneous actions the user has taken, such as sending a message or adding a\nsong to a playlist. For these instantaneous actions, don't call [start(Action)](/docs/reference/android/com/google/firebase/appindexing/FirebaseUserActions#start(com.google.firebase.appindexing.Action)) at all, but just [end(Action)](/docs/reference/android/com/google/firebase/appindexing/FirebaseUserActions#end(com.google.firebase.appindexing.Action)). \n\nParameters\n\nReturns\n\n- A [Task](/docs/reference/android/com/google/android/gms/tasks/Task) indicating the result of the operation. \n\npublic static synchronized [FirebaseUserActions](/docs/reference/android/com/google/firebase/appindexing/FirebaseUserActions)\n**getInstance** ([Context](//developer.android.com/reference/android/content/Context.html) context) \nReturns an instance of [FirebaseUserActions](/docs/reference/android/com/google/firebase/appindexing/FirebaseUserActions).\n\nThis method does not require FirebaseApp initialization. Instead, the application\ncontext is inferred from the `context` that is explicitly passed in. \n\npublic abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **start** ([Action](/docs/reference/android/com/google/firebase/appindexing/Action) action) \nLogs that the user has started doing something in the app.\n\nUse this method for a user action of some duration, like viewing an article or\nlistening to a song. If the action is instantaneous, such as sending a message or\nadding a song to a playlist, then make a single call to [end(Action)](/docs/reference/android/com/google/firebase/appindexing/FirebaseUserActions#end(com.google.firebase.appindexing.Action)) instead. \n\nParameters\n\nReturns\n\n- A [Task](/docs/reference/android/com/google/android/gms/tasks/Task) indicating the result of the operation."]]