Android SDK Callbacks
The SDK sends events for errors and the current ad state.
Integration
Implement the FeedAdListener
:
FeedAdListener listener = new FeedAdListener { /* ... */ };
Register and un-register the listener with the activity's lifecycle callbacks:
public class MyActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); FeedAd.addListener(listener); } @Override protected void onDestroy() { FeedAd.removeListener(listener); super.onDestroy(); } }
Always think of un-registering your listeners if they keep a reference to an activity-context.
Otherwise this will cause memory leaks if the activity is destroyed prior to un-registering the listener.
For further information about the SDK callbacks, check the listener's Javadoc in your IDE.