Android SDK Options

The SDK supports the setting of options for better ad targeting, playback behavior, and icon resources.

Ad Targeting Options

You can specify additional information about the current user. The data is sent along ad requests to achieve better ad targeting. It can also be used to link Custom Events to a specific user.

Integration

// create the config
FeedAdConfig config = FeedAdConfig.newBuilder()
    .setUserAge(42)
    .setUserId("your-user-id")
    /* ... */
    .build();

// set the config
FeedAd.setConfig(config);

// reset to default config
FeedAd.setConfig(null);

The config can be set at any time and from any thread.

Config Parameters

Name Description
user age the age of the current user in years
user id the ID of the current user
user gender the gender of the current user

Playback Behavior

Depending on the ad's config, FeedAd plays the ad on any activity by default. However, it is sometimes necessary to prevent FeedAd ad playback for specific activities.
This can be achieved by adding the @FeedAdOptions annotation to the activity and setting the annotation parameter preventPlayback to true:

@FeedAdOptions(preventPlayback = true)
public class NoPlaybackActivity extends Activity {
    /* ... */
}

When such an annotated activity is started, all current FeedAd playback is stopped.


UI Resources

You can change the appearance of the following FeedAd UI elements by overriding the resources file:

Mute / Unmute Button

  • Resource name: dr_feedad_mute_btn_selector.xml
  • Type: drawable
  • Recommended type: selector drawable
  • Recommended size: 24x24 dp
  • Resource state: checked = true if audio is not muted

Example:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="false">
        <bitmap
            android:gravity="right|bottom"
            android:src="@drawable/btn_muted"/>
    </item>
    <item android:state_checked="true">
        <bitmap
            android:gravity="right|bottom"
            android:src="@drawable/btn_muted"/>
    </item>
</selector>