GithubHelp home page GithubHelp logo

realmedianow-android-sdk's Introduction

realMediaNow-android-sdk

Installation

JitPack

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

And then, add the dependency

dependencies {
	implementation 'com.github.adbutler:adbutler-android-sdk:1.0.2'
}

Usage

Requesting Single Placement

To request a placement, you can build an instance of PlacementRequestConfig and specify the attributes you want to send. The builder accepts the RealMediaNow account ID, the zone ID, the width of the zone, and the height of the zone in the same sequence as mentioned. In the following example, 153105 is the RealMediaNow account ID, 214764 is the zone ID, 300 is the zone width, and 250 is the zone height.

PlacementRequestConfig config = new PlacementRequestConfig.Builder(153105, 214764, 300, 250).build();
RealMediaNow realMediaNow = new RealMediaNow();
realMediaNow.requestPlacement(config, new PlacementResponseListener() {
  // handle response
});

Requesting Multiple Placements

To request multiple placements, you need a list of PlacementRequestConfigs, and each for a placement respectively:

List<PlacementRequestConfig> configs = getPlacementRequestConfigs();
RealMediaNow realMediaNow = new RealMediaNow();
realMediaNow.requestPlacements(configs, new PlacementResponseListener() {
  // handle response
});

Handling the Response

Placement(s) request will take a given listener, and call its methods based on the status of the response accordingly.

RealMediaNow realMediaNow;
realMediaNow.requestPlacements(configs, new PlacementResponseListener() {
  @Override
  public void success(PlacementResponse response) {
    // Handle success case
  }

  @Override
  public void error(Throwable throwable) {
    // Handle error cases
  }
});

Request Pixel

You can request a pixel simply by giving the URL:

RealMediaNow realMediaNow = new RealMediaNow();
realMediaNow.requestPixel("ads.realmedianow.com/default_banner.gif");

Record Impression

When you have a Placement, you can record impression by:

Placement placement;
placement.recordImpression()

The best practice for recording impressions is to do so when the placement is visible on the screen / has been seen by the user.

Record Click

Similarly, you can record click for a Placement:

Placement placement;
placement.recordClick()

Sample Project

Please check out the sample project inside this repository to see more sample code about how to use this SDK.

License

This SDK is released under the Apache 2.0 license. See LICENSE for more information.

realmedianow-android-sdk's People

Contributors

aapatrick avatar sanakhet avatar baig avatar tharris7 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.