Freshpaint Android SDK Reference

Initialization and Configuration

Importing the SDK

1
import com.freshpaint.android.Freshpaint;
Copied!

Initializing the SDK

1
Freshpaint freshpaint = new Freshpaint.Builder(getApplicationContext(), "<your environment id>")
2
.trackApplicationLifecycleEvents()
3
.recordScreenViews()
4
.build();
5
6
Freshpaint.setSingletonInstance(freshpaint);
Copied!
You can get your environment id from the Freshpaint sources page.
Before making the call to build() you can call different methods to customize the behavior of the Freshpaint SDK. Here are some of the supported customization options:

iOS SDK API

track

The track call can be used to manually send data to your destinations.
1
Freshpaint
2
.with(getActivity().getApplicationContext())
3
.track("Purchase", new Properties().putValue("Price", 500));
Copied!
Argument
Swift/Objective-C Type
Required
Description
event
String
Yes
The name of the event to send.
properties
Properties
No
Additional properties to attach to the event.

identify

The identify call attaches an identity or user properties to the user.
1
Freshpaint
2
.with(getActivity().getApplicationContext())
3
.identify("[email protected]", new Traits()
4
.putValue("email", "[email protected]")
5
.putValue("name", "Ada Lovelace")
6
);
Copied!
Argument
Swift/Objective-C Type
Required
Description
userId
String
No
The id to attach to the user.
traits
Traits
No
Additional user properties to attach to the user.

screen

The screen call triggers a screen event. This is the mobile equivalent of a pageview event. Some destinations will treat this event specially.
1
Freshpaint
2
.with(getActivity().getApplicationContext())
3
.screen("Home Screen", new Properties().putValue("A/B Test Variant", "A"));
Copied!
Argument
Swift/Objective-C Type
Required
Description
name
String
Yes
The name of the screen.
properties
Properties
No
Additional properties to attach to the event.

group

The group call associates the user with a user group. Some destinations let you work with groups of users. For example, Amplitude lets you group users together and then perform analytics on the individual groups. Most often, a group of users is all users that work for a single organization.
1
Freshpaint
2
.with(getActivity().getApplicationContext())
3
.group("Google", new Traits()
4
.putValue("plan", "enterprise")
5
.putValue("sign-up-date", "04/04/2019")
6
);
Copied!
Argument
Swift/Objective-C Type
Required
Description
groupId
String
Yes
The id of the group to add the user to.
traits
Properties
No
Additional properties to attach to the group.

alias

The alias call can be used to specify one user id as an alias for another user id. Calling this will alias the current user's identity to the new provided identity. This is needed to implement identify for some destinations, specifically Mixpanel and Kissmetrics.
1
Freshpaint
2
.with(getActivity().getApplicationContext())
3
.alias("[email protected]");
Copied!
Swift
Objective-C
1
Freshpaint.shared().alias("[email protected]")
Copied!
1
[[FPAnalytics sharedAnalytics] alias:@"[email protected]"];
Copied!
Argument
Swift/Objective-C Type
Required
Description
newId
String
Yes
The id you want to alias the current user's identity to.
Last modified 8mo ago