SDK

Segmentation

This is an add-on feature of Notificare. You will need to subscribe to the Users & Authentication add-on and configure this service as described here. Once subscribed, before you can use this functionality, make sure you create User Preferences like explained here.

The following methods are also only available when users are authenticated. This functionality will allow you to create a rich user profile based on your users preferences, personal information, etc.

To get a list of preferences for a user, use the following method:

Notificare.shared().fetchUserPreferences(new NotificareCallback<List<NotificareUserPreference>>() {
    @Override
    public void onSuccess(List<NotificareUserPreference> notificareUserPreferences) {

    }

    @Override
    public void onError(NotificareError notificareError) {

    }
}
Notificare.shared().fetchUserPreferences(object : NotificareCallback<List<NotificareUserPreference?>?> {
    override fun onSuccess(notificareUserPreferences: List<NotificareUserPreference?>?) {

    }

    override fun onError(notificareError: NotificareError) {

    }
})

To add a user to a segment, invoke the method below:

Notificare.shared().userSegmentAddToUserPreference(preference.getPreferenceOptions().get(which).getUserSegmentId(), preference, new NotificareCallback<Boolean>() {
    @Override
    public void onSuccess(Boolean aBoolean) {

    }

    @Override
    public void onError(NotificareError notificareError) {

    }
});
Notificare.shared().userSegmentAddToUserPreference(preference.getPreferenceOptions().get(which).getUserSegmentId(), preference, object : NotificareCallback<Boolean?> {
    override fun onSuccess(aBoolean: Boolean?) {

    }

    override fun onError(notificareError: NotificareError) {

    }
})

To remove a user from a segment, invoke the method below:

Notificare.shared().userSegmentRemoveFromUserPreference(preference.getPreferenceOptions().get(which).getUserSegmentId(), preference, new NotificareCallback<Boolean>() {
    @Override
    public void onSuccess(Boolean aBoolean) {

    }

    @Override
    public void onError(NotificareError notificareError) {

    }
});
Notificare.shared().userSegmentRemoveFromUserPreference(preference.getPreferenceOptions().get(which).getUserSegmentId(), preference, object : NotificareCallback<Boolean?> {
    override fun onSuccess(aBoolean: Boolean?) {

    }

    override fun onError(notificareError: NotificareError) {

    }
})

This functionality will allow you to categorize your users based on their preferences. You can then easily create campaigns using these segments.