Android SDK Version
Field Summary
Modifier and TypeFieldDescription
private final StringACTION_APP_EVENTS_FLUSHED
private final StringAPP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED
private final StringAPP_EVENTS_EXTRA_FLUSH_RESULT
public final static AppEventsLogger.CompanionINSTANCE
Method Summary
Modifier and TypeMethodDescription
final UnitactivateApp(Application application) Notifies the events system that the app has launched and activate and deactivate events should start being logged automatically.
final UnitactivateApp(Application application, String applicationId) Notifies the events system that the app has launched and activate and deactivate events should start being logged automatically.
final UnitinitializeLib(Context context, String applicationId) Notifies the events system which internal SDK Libraries, and some specific external Libraries that the app is utilizing.
final AppEventsLoggernewLogger(Context context) Build an AppEventsLogger instance to log events through.
final AppEventsLoggernewLogger(Context context, AccessToken accessToken) Build an AppEventsLogger instance to log events through.
final AppEventsLoggernewLogger(Context context, String applicationId, AccessToken accessToken) Build an AppEventsLogger instance to log events through.
final AppEventsLoggernewLogger(Context context, String applicationId) Build an AppEventsLogger instance to log events that are attributed to the application but not to any particular Session.
final AppEventsLogger.FlushBehaviorgetFlushBehavior() Access the behavior that AppEventsLogger uses to determine when to flush logged events to the server.
final UnitsetFlushBehavior(AppEventsLogger.FlushBehavior flushBehavior) Set the behavior that this AppEventsLogger uses to determine when to flush logged events to the server.
final UnitonContextStop() Call this when the consuming Activity/Fragment receives an onStop() callback in order to persist any outstanding events to disk so they may be flushed at a later time.
final UnitsetPushNotificationsRegistrationId(String registrationId) Sets and sends registration id to register the current app for push notifications.
final UnitaugmentWebView(WebView webView, Context context) Intended to be used as part of a hybrid webapp.
final StringgetUserID() Returns the set user id else null.
final UnitsetUserID(String userID) Sets a user id to associate with all app events.
final UnitclearUserID() Clears the currently set user id.
final UnitsetUserData(String email, String firstName, String lastName, String phone, String dateOfBirth, String gender, String city, String state, String zip, String country) Sets user data to associate with all app events.
final StringgetUserData() Returns the set user data else null.
final UnitclearUserData() Clears the current user data
final StringgetAnonymousAppDeviceGUID(Context context) Each app/device pair gets an GUID that is sent back with App Events and persisted with this app/device pair.
final UnitsetInstallReferrer(String referrer)
final StringgetACTION_APP_EVENTS_FLUSHED() The action used to indicate that a flush of app events has occurred.
final StringgetAPP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED()
final StringgetAPP_EVENTS_EXTRA_FLUSH_RESULT()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail

activateApp

 final UnitactivateApp(Application application)
Notifies the events system that the app has launched and activate and deactivate events should start being logged automatically. By default this function is called automatically from sdkInitialize() flow. In case 'com.facebook.sdk.AutoLogAppEventsEnabled' manifest setting is set to false, it should typically be called from the OnCreate method of you application.
Parameters:
application - The running application

activateApp

 final UnitactivateApp(Application application, String applicationId)
Notifies the events system that the app has launched and activate and deactivate events should start being logged automatically. By default this function is called automatically from sdkInitialize() flow. In case 'com.facebook.sdk.AutoLogAppEventsEnabled' manifest setting is set to false, it should typically be called from the OnCreate method of you application.
Call this if you wish to use a different Application ID then the one specified in the Facebook SDK.
Parameters:
application - The running application
applicationId - The application id used to log activate/deactivate events.

initializeLib

 final UnitinitializeLib(Context context, String applicationId)
Notifies the events system which internal SDK Libraries, and some specific external Libraries that the app is utilizing. This is called internally and does NOT need to be called externally.
Parameters:
context - The Context
applicationId - The String applicationId

newLogger

 final AppEventsLoggernewLogger(Context context)
Build an AppEventsLogger instance to log events through. The Facebook app that these events are targeted at comes from this application's metadata. The application ID used to log events will be determined from the app ID specified in the package metadata.
Parameters:
context - Used to access the applicationId and the attributionId for non-authenticated users.

newLogger

 final AppEventsLoggernewLogger(Context context, AccessToken accessToken)
Build an AppEventsLogger instance to log events through.
Parameters:
context - Used to access the attributionId for non-authenticated users.
accessToken - Access token to use for logging events.

newLogger

 final AppEventsLoggernewLogger(Context context, String applicationId, AccessToken accessToken)
Build an AppEventsLogger instance to log events through.
Parameters:
context - Used to access the attributionId for non-authenticated users.
applicationId - Explicitly specified Facebook applicationId to log events against.
accessToken - Access token to use for logging events.

newLogger

 final AppEventsLoggernewLogger(Context context, String applicationId)
Build an AppEventsLogger instance to log events that are attributed to the application but not to any particular Session.
Parameters:
context - Used to access the attributionId for non-authenticated users.
applicationId - Explicitly specified Facebook applicationId to log events against.

getFlushBehavior

 final AppEventsLogger.FlushBehaviorgetFlushBehavior()
Access the behavior that AppEventsLogger uses to determine when to flush logged events to the server. This setting applies to all instances of AppEventsLogger.

setFlushBehavior

 final UnitsetFlushBehavior(AppEventsLogger.FlushBehavior flushBehavior)
Set the behavior that this AppEventsLogger uses to determine when to flush logged events to the server. This setting applies to all instances of AppEventsLogger.
Parameters:
flushBehavior - the desired behavior.

onContextStop

 final UnitonContextStop()
Call this when the consuming Activity/Fragment receives an onStop() callback in order to persist any outstanding events to disk so they may be flushed at a later time. The next flush (explicit or not) will check for any outstanding events and if present, include them in that flush. Note that this call may trigger an I/O operation on the calling thread. Explicit use of this method is necessary.

setPushNotificationsRegistrationId

 final UnitsetPushNotificationsRegistrationId(String registrationId)
Sets and sends registration id to register the current app for push notifications.
Parameters:
registrationId - RegistrationId received from FCM.

augmentWebView

 final UnitaugmentWebView(WebView webView, Context context)
Intended to be used as part of a hybrid webapp. If you call this method, the FB SDK will add a new JavaScript interface into your webview. If the FB Pixel is used within the webview, and references the app ID of this app, then it will detect the presence of this injected JavaScript object and pass Pixel events back to the FB SDK for logging using the AppEvents framework.
Parameters:
webView - The webview to augment with the additional JavaScript behaviour
context - Used to access the applicationId and the attributionId for non-authenticated users.

getUserID

 final StringgetUserID()
Returns the set user id else null.

setUserID

 final UnitsetUserID(String userID)
Sets a user id to associate with all app events. This can be used to associate your own user id with the app events logged from this instance of an application.
The user ID will be persisted between application instances.
Parameters:
userID - A User ID, or null to clear the User ID

clearUserID

 final UnitclearUserID()
Clears the currently set user id.

setUserData

 final UnitsetUserData(String email, String firstName, String lastName, String phone, String dateOfBirth, String gender, String city, String state, String zip, String country)
Sets user data to associate with all app events. All user data are hashed and used to match Facebook user from this instance of an application.
The user data will be persisted between application instances.
Parameters:
email - user's email
firstName - user's first name
lastName - user's last name
phone - user's phone
dateOfBirth - user's date of birth
gender - user's gender
city - user's city
state - user's state
zip - user's zip
country - user's country

getUserData

 final StringgetUserData()
Returns the set user data else null.

clearUserData

 final UnitclearUserData()
Clears the current user data

getAnonymousAppDeviceGUID

 final StringgetAnonymousAppDeviceGUID(Context context)
Each app/device pair gets an GUID that is sent back with App Events and persisted with this app/device pair.
Parameters:
context - The application context.

setInstallReferrer

 final UnitsetInstallReferrer(String referrer)

getACTION_APP_EVENTS_FLUSHED

 final StringgetACTION_APP_EVENTS_FLUSHED()
The action used to indicate that a flush of app events has occurred. This should be used as an action in an IntentFilter and BroadcastReceiver registered with the [ ].

getAPP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED

 final StringgetAPP_EVENTS_EXTRA_NUM_EVENTS_FLUSHED()

getAPP_EVENTS_EXTRA_FLUSH_RESULT

 final StringgetAPP_EVENTS_EXTRA_FLUSH_RESULT()