User Info
Information about the user of your app can be useful for personalization and
segmentation. For example, you might want to address push notifications to each
user by name or you may want to segment a campaign to only users who have
opted-in to receive marketing material. The UserInfo
service provides an API
for you to add information about the current user that will be sent to Rover’s
servers and can be utilized for personalization purposes in the Campaigns
app and segmentation purposes in the Audience
app. You’ll access it through
UserInfoInterface
.
Setting Properties
You can set info about the current user on the UserInfo
service using the
update()
method. The update()
method has a single parameter – a closure with
an argument of a copy of the currently set attributes as a hash. Mutate those
attributes to add the fields you desire, and they’ll be merged into any other
existing fields and values you have already set. The values are of type
AttributeValue
, which constrains the types that you may assign.
Rover.sharedInstance.resolveSingletonOrFail(
UserInfoInterface::class.java
).update { attributes ->
attributes["first_name"] = AttributeValue.Scalar.String("Sean")
}
Clearing Properties
In some cirucmstances you may wish to remove all properties associated with the
current user. For example, if your app supports authentication and the user
logs-out. To remove all user info call the clear()
method on
UserInfoInterface
.
Rover.sharedInstance.resolveSingletonOrFail(
UserInfoInterface::class.java
).clear()
Required Modules
- Core