AppBrainUserData
- public class AppBrainUserData
Class to hold data about a user. It has a builder-like pattern so you can chain calls like:
AppBrain.getAds().setUserData(AppBrainUserData.create().setGender(gender).setLocation(location));
All fields are optional, so you can set any combination of them.
- Author
AppBrain
Methods
- public AppBrainUserData addKeyword(String keyword)
Add a keyword. This can be anything relevant to the context of the user.
One example could be a word game with multiple categories “animals”, “sports”, “countries” and the keyword is then the last category the user played. Another example could be an app in which the user can type search queries, and the keyword can be the last search query of the user.
- public AppBrainUserData addKeywords(Collection<String> keywords)
Add a collection of keywords relevant to the context of the user. See
addKeyword(String)
.
- public static AppBrainUserData create()
- Returns
a new AppBrainUserData instance.
- public Date getBirthDate()
- Returns
the value set by
setBirthDate(Date)
.
- public Gender getGender()
- Returns
the value set by
setGender(Gender)
.
- public Set<String> getKeywords()
- Returns
all keywords added by
addKeyword(String)
oraddKeywords(Collection)
.
- public Location getLocation()
- Returns
the value set by
setLocation(Location)
.
- public AppBrainUserData setBirthDate(Date date)
Allows you to set the user’s age. For young users COPPA compliance will be enabled automatically.
- public AppBrainUserData setGender(Gender gender)
Allows you to set the user’s gender.
Gender.UNKNOWN
is the default.
- public AppBrainUserData setLocation(Location location)
Set a recently retrieved location of the user (acquired from the android LocationManager or Google Play Service’s LocationClient).