ThirdPartyAdapters/adcolony/adcolony/src/main/java/com/jirbo/adcolony/AdColonyManager.java
/**
   * Places user_id, age, location, and gender into AdColonyAppOptions.
   *
   * @param adRequest request received from AdMob.
   * @return a valid AppOptions object.
   */
Places user_id, age, location, and gender into AdColonyAppOptions.
@param adRequest request received from AdMob.
@return a valid AppOptions object.
Places user_id age location and gender into AdColonyAppOptions . @param adRequest request received from AdMob . @return a valid AppOptions object .
private AdColonyAppOptions buildAppOptions(MediationAdRequest adRequest) {
    AdColonyAppOptions options = AdColonyMediationAdapter.getAppOptions();
    if (adRequest != null) {
      if (adRequest.isTesting()) {
        options.setTestModeEnabled(true);
      }
      AdColonyUserMetadata userMetadata = new AdColonyUserMetadata();
      int genderVal = adRequest.getGender();
      if (genderVal == AdRequest.GENDER_FEMALE) {
        userMetadata.setUserGender(AdColonyUserMetadata.USER_FEMALE);
      } else if (genderVal == AdRequest.GENDER_MALE) {
        userMetadata.setUserGender(AdColonyUserMetadata.USER_MALE);
      }
      Location location = adRequest.getLocation();
      if (location != null) {
        userMetadata.setUserLocation(location);
      }
      Date birthday = adRequest.getBirthday();
      if (birthday != null) {
        long currentTime = System.currentTimeMillis();
        long birthdayTime = birthday.getTime();
        long diff = currentTime - birthdayTime;
        if (diff > 0) {
          long day = (1000 * 60 * 60 * 24);
          long yearsPassed = diff / day / 365;
          userMetadata.setUserAge((int) yearsPassed);
        }
      }
      options.setUserMetadata(userMetadata);
    }
    return options;
  }
private AdColonyAppOptions buildAppOptions ( MediationAdRequest adRequest ) { AdColonyAppOptions options = AdColonyMediationAdapter . getAppOptions ( ) ; if ( adRequest != null ) { if ( adRequest . isTesting ( ) ) { options . setTestModeEnabled ( true ) ; } AdColonyUserMetadata userMetadata = new AdColonyUserMetadata ( ) ; int genderVal = adRequest . getGender ( ) ; if ( genderVal == AdRequest . GENDER_FEMALE ) { userMetadata . setUserGender ( AdColonyUserMetadata . USER_FEMALE ) ; } else if ( genderVal == AdRequest . GENDER_MALE ) { userMetadata . setUserGender ( AdColonyUserMetadata . USER_MALE ) ; } Location location = adRequest . getLocation ( ) ; if ( location != null ) { userMetadata . setUserLocation ( location ) ; } Date birthday = adRequest . getBirthday ( ) ; if ( birthday != null ) { long currentTime = System . currentTimeMillis ( ) ; long birthdayTime = birthday . getTime ( ) ; long diff = currentTime - birthdayTime ; if ( diff > 0 ) { long day = ( 1000 * 60 * 60 * 24 ) ; long yearsPassed = diff / day / 365 ; userMetadata . setUserAge ( ( int ) yearsPassed ) ; } } options . setUserMetadata ( userMetadata ) ; } return options ; }
Places user_id, age, location, and gender into AdColonyAppOptions.
Places user_id age location and gender into AdColonyAppOptions .
// Enable test ads from AdColony when a Test Ad Request was sent. // Try to update userMetaData with gender field. // Try to update userMetaData with location (if provided). // Try to update userMetaData with age if birth date is provided.