Rectangle Banners will be rendered using the HyBid SDK.


  • Ad Zone Id from the PubNative Publisher Dashboard

Code sample

You can find a demo app with code samples for this type of integration here.

Create XML layout

Create a HyBidMRectAdView inside your layout file


Create an attribute to hold the reference to the UI element.

private HyBidMRectAdView mMRect;

Get a reference to it from your code.

mMRect = findViewById(;

Requesting and displaying the ad

Use the load method to request an ad using the zone id and setting a listener for the mrect.

private void loadMRect() {
    mMRect.load("ZONE_ID", new PNAdView.Listener() {
        public void onAdLoaded() {

        public void onAdLoadFailed(Throwable error) {


        public void onAdImpression() {


        public void onAdClick() {


Once the ad is loaded successfully from the server, the HyBidMRectAdView will render it and notify when it's ready via the onAdLoaded callback. Any error during fetch or rendering will be received via the onAdLoadFailed callback.

onAdImpression and onAdClick just notify of clicks and impressions. No code needs to be added there. Use those callbacks in case you want to hide the ad after click or some similar use case.

Finally destroy the mrect when the activity or fragment are destroyed

public void onDestroy() {
    if (mMRect != null) {