Analytics

Entry point for the Titan SDK. It allows you to initialize the SDK as indicated in the SDK setup section.

Public methods

initialize(Context context, String apiKey)

Initializes the analytics SDK using the API key.

You won’t be able to provide more advanced settings if you initialize the SDK using this method. See configuration.


initialize(Context context, Settings settings)

Initializes the analytics SDK using the given Settings implementation.

This is useful for advanced configuration with SimpleSettings.

The other public initialization methods ultimately call through to this method.


initialize(Context context, String apiKey, Logger logger, boolean installTrackingEnabled, boolean allowSysEventsAsCustomEvents)

Initialize with all configurable parameters as arguments

  • context Context for initialization
  • apiKey API key
  • logger Logger implementation, can be null
  • installTrackingEnabled Whether to track installs. Send false for known upgrades
  • allowSysEventsAsCustomEvents Whether to allow sys.-prefixed events via the custom event method

getInstance()

Returns the singleton instance of the Analytics class.


getProfilePropertiesEditor()

Returns an interface to add/remove profile properties. See ProfilePropertiesEditor.

Example

Updates the gender and Facebook ID super properties

Analytics analytics = Analytics.getInstance();
ProfilePropertiesEditor profileEditor = analytics.getProfilePropertiesEditor();
profileEditor.setGender(Gender.FEMALE);
profileEditor.setFacebookId("314159265358979323846");

getDeviceToken()

Returns the device token or null if there’s none yet. Device token is a unique identifier for the current device.


getDeviceToken(DeviceTokenListener listener)

Returns the device token via the provided listener. If the listener is null, this solely ensures that the device has a device token.

See also

Tracker