
Android
API Wrapper Functions
The SDK provides wrapper functions for the following API calls for your convenience: get offers, get surveys and get transactions.
Getting Offers
Following is the sample code for getting offers from the AdscendMedia server:
public static String pubId = "32740";
public static String adwallId = "2074";
public static String subId = "demo_subid1";
// offset - offset index from which offers are to be retrieved (e.g. offset = 0 will return all offers starting from index 0 and offset = 20 will return offers starting from index 20)
ADOfferRequestListener requestListener = new ADOfferRequestListener() {
// if moreAvailable flag is true then again call 'AdscendMediaWrapper.getOffersList()' API with offset parameter equals the number of offers returned till now
@Override
public void onSuccess(JsonArray offersArray, boolean moreAvailable) {
Log.d(TAG, "getOffersList onSuccess response code"+ offersArray.size());
}
@Override
public void onFailure(Object message) {
Log.d(TAG, "getOffersList onFailure response code"+ message);
}
};
AdscendMediaWrapper.getOffersList(getApplicationContext(), pubId, adwallId, subId1, offset + "", requestListener); // Call to getCompletedOffers api from sdk
The offerList array will have the list of offers. It is a list of dictionaries with each dictionary having following format:
{
"category_id" = (
17,
18,
19
);
"click_url" = "https://stage.asmclk.com/click.php?aff=102784&camp=116728&from=4346&prod=4&sub1=23&prod_channel=3&device=F31FC43C-A9D6-49B0-94F9-EA73A8BE1005&xt=dyiBHvSsikEs0MCY4lwnAKru9AQKdIFmPaOGHno83R%2FGkDHi%2F0eygNaUQmAJt%2FFVe1cDEX54tEm%2FPaIn8e5KBw%3D%3D%3AVIaTlx4%2F1LX5gmlcEI4NMg%3D%3D";
"conversion_rate" = "";
"creative_filename" = "";
"creative_id" = "";
"creative_url" = "";
"credit_delay" = 0;
"currency_count" = 100;
description = "Rewarded video offer";
epc = "";
"featured_global" = 1;
"featured_profile" = 0;
"image_url" = "";
"matches_target_system_detected" = 1;
"mobile_app" = {
platform = 1;
"store_id" = "com.bsb.hike";
};
name = "Rewarded video offer";
"offer_id" = 116728;
payout = "0.1";
"payout_custom" = 0;
"rating_count" = 1859803;
requirements = "";
"stats_pending_ce" = 1;
"target_system" = 0;
"testing_status" = 0;
"testing_time" = "0000-00-00 00:00:00";
}
Getting Market Research Surveys
Following is the sample code for getting market surveys from the AdscendMedia server:
public static String pubId = "32740";
public static String adwallId = "2074";
public static String subId = "demo_subid1";
JsonArrayRequestListener requestListener = new JsonArrayRequestListener() {
@Override
public void onSuccess(JsonArray surveyArray) {
Log.d(TAG, "get surveys json onSuccess");
}
@Override
public void onFailure(Object message) {
Log.d(TAG, "get surveys json onFailure");
}
};
//productId - "4" or "10";
// "4" is for surveys on offer wall profile
// "10" is for surveys on mr profile
String productId = "4";
AdscendMediaWrapper.getSurveysList(getApplicationContext(), pubId, profileId, subId1, productId, requestListener);
The surveyList array will have the list of market surveys. It is a list of dictionaries with each dictionary having following format:
{
campId = 45003;
"click_url" = "https://stage.asmclk.com/click.php?aff=102784&camp=45003&from=4346&prod=4&sub1=23&prod_channel=3&device=92D64400-4BC3-42C4-B376-DE4CB3876E32&xt=iWNGlbuv2u5TsVFpUXUyypsrSHsdlqumcBZs2JcCMg3Dody6OnfHUCmJ72BSW9eTCeArkyOPU2Vfo2oUzX495VQPFplfzPeUhTzuTAIvJE%2BSdI7c%2F7FvxL1FiTyX90p3PTp4zvHXdwx0lq21cbi%2B3PgZrduiyE4BGmpdS0H89dMEHDvGPh4YnqSzoPlEtfzjHgVYntAvdAtEejUEp59WM3AKZxKEGB6gMQD5M%2F3vAfph%2FBGcXSah1Ov2zcFta1u6WNU9t1FimC0Pt2QSnGSwgVmrVzutNIOTPEBgxzC63TReM0rhCVHDP5H4%2FgAd6G4QT6yCruaAXhx2y7JSAVKuhZzjTq7qLscFNYMzUrOTTlQsK9azl2xyFmmQbfP2w9M7%3Ad%2B0EHVWa1CtA72%2B2hNQC3g%3D%3D";
"currency_count" = "1687.5";
minutes = 10;
name = "High Paying Survey";
payout = "1.6875";
}
Getting Transaction History
Following is the sample code for getting transactions from the AdscendMedia server:
JsonArrayRequestListener requestListener = new JsonArrayRequestListener() {
@Override
public void onSuccess(JsonArray transactionArray) {
Log.d(TAG, "get history json onSuccess");
}
@Override
public void onFailure(Object message) {
Log.d(TAG, "get history json onFailure");
}
};
AdscendMediaWrapper.getTransactionList(pubId, adwallId, subId1, requestListener); // Call to getHistoryJson api from sdk
The transactionList array will have the list of transactions. It is a list of dictionaries with each dictionary having following format:
{
"currency_adjustment" = 20;
description = "";
"offer_id" = 116868;
"offer_name" = "RV test offer #5000";
timestamp = "2016-08-23T05:01:54-0500";
"transaction_id" = 2786662;
}