Android SDK FAQ

How to play Audio Ads along with Dialogue Ads?

If you are going to be playing Audio Ads, along with Voice-Activated Ads, you will need to use the following code

.setType(Type.ANY)

Instead of

.setType(Type.VOICE)

How to preload ads?

In the case of preloading, it is necessary to call the method adman.sendCanShow() at the time of possible launch of advertising, even in cases, when advertising wasn't actually loaded.

To preload an ad, please use the following

adman.preload();
  • In case of the preload completed correctly, onAdmanEvent would be raised with AdmanEvent.Type.READY

  • If there is no advertisement AdmanEvent.Type.NONE will be raised.

  • In case of the preload error AdmanEvent.Type.ERROR will be raised.

When the AdmanEvent.Type.READY is raised, then playback can be started. Before the playback you need to call adman.sendCanShow() method. Then you can start playback using following:

adman.play();

The AdmanEvent.Type.PLAYING will be raised once the playback begins. The AdmanEvent.Type.COMPLETED will be raised after the end of ad playback.

How to change screen orientation?

If an application supports the screen orientation change, the following code should be used to update the advertisement:

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
((IAdmanView) adman.getModule(IAdmanView.ID)).rebuild();
}

How to run multiple instances of Adman?

Please use the following code in order to run multiple instances of Adman for different regions:

adman = new Adman(context,
new AdmanRequest[]{
new AdmanRequest.Builder().setRegion(Region.EUROPE).setSiteId(777).build(), new AdmanRequest.Builder().setRegion(Region.GLOBAL).setSiteId(777).build(),
}
);

How to specify slot while requesting an ad?

In order to set the slot, please use the following code:

AdmanRequest.Builder parameters = new AdmanRequest.Builder().setSlot(Slot.NAME);

In order to update the 'Slot' parameter, please use the following call before calling adman.preload()

adman.updateRequest(Slot.NAME)

Possible values for NAME:

Value Name

Description

PREROLL

Will play only ads that should be played before the content or ads without specific slot.

MIDROLL

Will play only ads that should be played in the middle of the content or ads without specific slot.

POSTROLL

Will play only ads that should be played after the content or ads without specific slot.

How to customize the look of Ad View?

BaseAdmanView module is used to send the events from Adman (ad playback module) to visual elements of the SDK.

BaseAdmanView consists of the set of elements which are all described in AdmanViewType:

Element Name

Element Description

CONTAINER

layout with all the elements which are used to show the Audio Ad

BANNER

banner view

RESTART

R.id.adman_restart

PLAY

play button in the view

PAUSE

pause button in the view

LEFT

the timer

CLOSE

banner close button

VOICE_CONTAINER

layout for Dialogue Ads

VOICE_POSITIVE

'Yes' button

VOICE_NEGATIVE

'No' button

VOICE_MIC

microphone indication

VOICE_PROGRESS

indication of voice recognition

In order to use your custom layout with custom elements you need to inherit BaseAdmanView class. Then do the following:

public IAdmanViewBundleFactory factory() {
return this.factory;
}

You can find the usage example HERE

The factory method delivers the set of the elements (mentioned above) with the help of IAdmanViewBundleFactory interface.

All the visual elements are grouped according to the type of an ad (Audio or Dialogue) and to screen orientation. Please see the AdmanViewBindFactory for reference HERE

Next step is to send the instance of this class to Adman. Please see the example on how you can do this:

adman.bindModule(new DemoVoiceAdmanView(this));

Please do not forget that you should use the real module and class names from your actual project.

You can find the full example of the modified ad views HERE and HERE