setAudience(String sessionID, NameValuePairImpl[] audienceID, 
String audienceLevel, NameValuePairImpl[] parameters)
The setAudience method enables you to set the audience ID and level for a visitor.
sessionID - a string identifying the session ID.
audienceID - an array of NameValuePairImpl objects that defines the audience ID.
audienceLevel - a string that defines the audience level.
parameters - NameValuePairImpl objects identifying any parameters that need to be passed with setAudience. These values are stored in the session data and can be used for segmentation.
You must have a value for every column in your profile. This is a superset of all columns in all the tables defined for the interactive channel and any real-time data. If you have already populated all the session data with startSession or postEvent, you do not need to send new parameters.
The setAudience method triggers a re-segmentation. The getOffers method waits for re-segmentation to finish before running. Therefore, if you call a setAudience method immediately before a getOffers call, there may be a delay.
The setAudience method also loads the profile data for the audience ID. You can use the setAudience method to force a reload of the same profile data loaded by the startSession method.
Return value
The runtime server responds to setAudience with a Response object with the following attributes populated:
For this example, the audience level stays the same, but the ID changes, as if an anonymous user logs in and becomes known.
sessionId and audienceLevel are the same strings to identify the session and audience level used by the startSession call which started this session.
NameValuePair custId2 = new NameValuePairImpl();

NameValuePair[] newAudienceId = { custId2 };

/** Parameters can be passed in as well. For this example, there are no parameters,
* therefore pass in null */
NameValuePair[] noParameters=null;

/** Make the call */
response = api.setAudience(sessionId, newAudienceId, audienceLevel, noParameters);

/** Process the response appropriately */
// check if response is successful or not
if(response.getStatusCode() == Response.STATUS_SUCCESS)
System.out.println("setAudience call processed with no warnings or errors");
else if(response.getStatusCode() == Response.STATUS_WARNING)
System.out.println("setAudience call processed with a warning");
System.out.println("setAudience call processed with an error");

// For any non-successes, there should be advisory messages explaining why
if(response.getStatusCode() != Response.STATUS_SUCCESS)